-rw-r--r-- | noncore/apps/opie-reader/Aportis.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-reader/Bkmks.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-reader/BuffDoc.cpp | 18 | ||||
-rw-r--r-- | noncore/apps/opie-reader/CDrawBuffer.cpp | 22 | ||||
-rw-r--r-- | noncore/apps/opie-reader/QTReader.cpp | 52 | ||||
-rw-r--r-- | noncore/apps/opie-reader/QTReaderApp.cpp | 3231 | ||||
-rw-r--r-- | noncore/apps/opie-reader/StyleConsts.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-reader/fileBrowser.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-reader/opie-reader.pro | 12 | ||||
-rw-r--r-- | noncore/apps/opie-reader/plucker.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/opie-reader/plucker_base.cpp | 1402 |
11 files changed, 2390 insertions, 2381 deletions
diff --git a/noncore/apps/opie-reader/Aportis.cpp b/noncore/apps/opie-reader/Aportis.cpp index 2f8cdc3..06f44a4 100644 --- a/noncore/apps/opie-reader/Aportis.cpp +++ b/noncore/apps/opie-reader/Aportis.cpp | |||
@@ -28,14 +28,14 @@ CList<Bkmk>* Aportis::getbkmklist() | |||
28 | { | 28 | { |
29 | char name[17]; | 29 | char name[17]; |
30 | name[16] = '\0'; | 30 | name[16] = '\0'; |
31 | // qDebug("Record:%d, Length:%u",i,recordlength(i)); | 31 | // odebug << "Record:" << i << ", Length:" << recordlength(i) << "" << oendl; |
32 | gotorecordnumber(i); | 32 | gotorecordnumber(i); |
33 | fread(name,1,16,fin); | 33 | fread(name,1,16,fin); |
34 | unsigned long lcn; | 34 | unsigned long lcn; |
35 | fread(&lcn,sizeof(lcn),1,fin); | 35 | fread(&lcn,sizeof(lcn),1,fin); |
36 | lcn ^= 0xa5a5a5a5; | 36 | lcn ^= 0xa5a5a5a5; |
37 | lcn = SwapLong(lcn); | 37 | lcn = SwapLong(lcn); |
38 | // qDebug("Bookmark:%s:%u", name,lcn); | 38 | // odebug << "Bookmark:" << name << ":" << lcn << "" << oendl; |
39 | tchar tname[17]; | 39 | tchar tname[17]; |
40 | memset(tname, 0, sizeof(tname)); | 40 | memset(tname, 0, sizeof(tname)); |
41 | for (int i = 0; name[i] != 0; i++) | 41 | for (int i = 0; name[i] != 0; i++) |
@@ -121,7 +121,7 @@ int Aportis::OpenFile(const char *src) | |||
121 | PeanutHeader hdr0; | 121 | PeanutHeader hdr0; |
122 | gotorecordnumber(0); | 122 | gotorecordnumber(0); |
123 | fread(&hdr0, sizeof(hdr0), 1, fin); | 123 | fread(&hdr0, sizeof(hdr0), 1, fin); |
124 | // qDebug("Version:%x", ntohs(hdr0.Version)); | 124 | // odebug << "Version:" << ntohs(hdr0.Version) << "" << oendl; |
125 | if (hdr0.Version && 0x0200) | 125 | if (hdr0.Version && 0x0200) |
126 | { | 126 | { |
127 | bCompressed = 2; | 127 | bCompressed = 2; |
@@ -182,7 +182,7 @@ int Aportis::OpenFile(const char *src) | |||
182 | cbptr = 0; | 182 | cbptr = 0; |
183 | outptr = 0; | 183 | outptr = 0; |
184 | refreshbuffer(); | 184 | refreshbuffer(); |
185 | // qDebug("Number of records:[%u,%u]", nRecs, nRecs2); | 185 | // odebug << "Number of records:[" << nRecs << "," << nRecs2 << "]" << oendl; |
186 | return ret; | 186 | return ret; |
187 | } | 187 | } |
188 | 188 | ||
diff --git a/noncore/apps/opie-reader/Bkmks.cpp b/noncore/apps/opie-reader/Bkmks.cpp index 16bc1f1..480c240 100644 --- a/noncore/apps/opie-reader/Bkmks.cpp +++ b/noncore/apps/opie-reader/Bkmks.cpp | |||
@@ -217,15 +217,15 @@ CList<Bkmk>* BkmkFile::readall() | |||
217 | case 6: | 217 | case 6: |
218 | isUpgraded = false; | 218 | isUpgraded = false; |
219 | bl = readall00(read06); | 219 | bl = readall00(read06); |
220 | // qDebug("Correct version!"); | 220 | // odebug << "Correct version!" << oendl; |
221 | break; | 221 | break; |
222 | case 5: | 222 | case 5: |
223 | isUpgraded = true; | 223 | isUpgraded = true; |
224 | bl = readall00(read05); | 224 | bl = readall00(read05); |
225 | // qDebug("Known version!"); | 225 | // odebug << "Known version!" << oendl; |
226 | break; | 226 | break; |
227 | default: | 227 | default: |
228 | // qDebug("Unknown version!"); | 228 | // odebug << "Unknown version!" << oendl; |
229 | isUpgraded = true; | 229 | isUpgraded = true; |
230 | bl = readall00(read05); | 230 | bl = readall00(read05); |
231 | } | 231 | } |
diff --git a/noncore/apps/opie-reader/BuffDoc.cpp b/noncore/apps/opie-reader/BuffDoc.cpp index 4fbab93..68391b8 100644 --- a/noncore/apps/opie-reader/BuffDoc.cpp +++ b/noncore/apps/opie-reader/BuffDoc.cpp | |||
@@ -32,7 +32,7 @@ linkType BuffDoc::hyperlink(unsigned int n, QString& wrd) | |||
32 | 32 | ||
33 | void BuffDoc::locate(unsigned int n) | 33 | void BuffDoc::locate(unsigned int n) |
34 | { | 34 | { |
35 | // //qDebug("BuffDoc:locating:%u",n); | 35 | // //odebug << "BuffDoc:locating:" << n << "" << oendl; |
36 | lastword.empty(); | 36 | lastword.empty(); |
37 | lastsizes[0] = laststartline = n; | 37 | lastsizes[0] = laststartline = n; |
38 | #ifdef NEWLINEBREAK | 38 | #ifdef NEWLINEBREAK |
@@ -42,7 +42,7 @@ void BuffDoc::locate(unsigned int n) | |||
42 | #endif | 42 | #endif |
43 | // tchar linebuf[1024]; | 43 | // tchar linebuf[1024]; |
44 | if (exp != NULL) exp->locate(n); | 44 | if (exp != NULL) exp->locate(n); |
45 | // //qDebug("BuffDoc:Located"); | 45 | // //odebug << "BuffDoc:Located" << oendl; |
46 | } | 46 | } |
47 | 47 | ||
48 | #ifdef NEWLINEBREAK | 48 | #ifdef NEWLINEBREAK |
@@ -188,7 +188,7 @@ bool BuffDoc::getline(CDrawBuffer* buff, int wth, unsigned char _border) | |||
188 | margindone = true; | 188 | margindone = true; |
189 | } | 189 | } |
190 | else buff->empty(); | 190 | else buff->empty(); |
191 | // //qDebug("Buff:%s Lastword:%s", (const char*)toQString(buff->data()), (const char*)toQString(lastword.data())); | 191 | // //odebug << "Buff:" << toQString(buff->data()) << " Lastword:" << toQString(lastword.data()) << "" << oendl; |
192 | lastcheck = len = buff->length(); | 192 | lastcheck = len = buff->length(); |
193 | unsigned int slen = buff->width(len); | 193 | unsigned int slen = buff->width(len); |
194 | if (slen > w) | 194 | if (slen > w) |
@@ -322,8 +322,8 @@ bool BuffDoc::getline(CDrawBuffer* buff, int wth, int cw, unsigned char _border) | |||
322 | 322 | ||
323 | int BuffDoc::openfile(QWidget* _parent, const char *src) | 323 | int BuffDoc::openfile(QWidget* _parent, const char *src) |
324 | { | 324 | { |
325 | // //qDebug("BuffDoc:Openfile:%s", src); | 325 | // //odebug << "BuffDoc:Openfile:" << src << "" << oendl; |
326 | // //qDebug("Trying aportis %x",exp); | 326 | // //odebug << "Trying aportis " << exp << "" << oendl; |
327 | if (exp != NULL) delete exp; | 327 | if (exp != NULL) delete exp; |
328 | lastword.empty(); | 328 | lastword.empty(); |
329 | lastsizes[0] = laststartline = 0; | 329 | lastsizes[0] = laststartline = 0; |
@@ -378,7 +378,7 @@ int BuffDoc::openfile(QWidget* _parent, const char *src) | |||
378 | if (ret != 0) | 378 | if (ret != 0) |
379 | { | 379 | { |
380 | delete exp; | 380 | delete exp; |
381 | //qDebug("Trying ppms"); | 381 | //odebug << "Trying ppms" << oendl; |
382 | exp = new ppm_expander; | 382 | exp = new ppm_expander; |
383 | ret = exp->openfile(src); | 383 | ret = exp->openfile(src); |
384 | } | 384 | } |
@@ -386,7 +386,7 @@ int BuffDoc::openfile(QWidget* _parent, const char *src) | |||
386 | { | 386 | { |
387 | delete exp; | 387 | delete exp; |
388 | exp = new Text; | 388 | exp = new Text; |
389 | // //qDebug("Trying text"); | 389 | // //odebug << "Trying text" << oendl; |
390 | ret = exp->openfile(src); | 390 | ret = exp->openfile(src); |
391 | } | 391 | } |
392 | 392 | ||
@@ -396,7 +396,7 @@ int BuffDoc::openfile(QWidget* _parent, const char *src) | |||
396 | QMessageBox::information(_parent, PROGNAME, "Unknown file compression type","Try another file"); | 396 | QMessageBox::information(_parent, PROGNAME, "Unknown file compression type","Try another file"); |
397 | return ret; | 397 | return ret; |
398 | } | 398 | } |
399 | // //qDebug("Doing final open:%x:%x",exp,filt); | 399 | // //odebug << "Doing final open:" << exp << ":" << filt << "" << oendl; |
400 | 400 | ||
401 | lastword.empty(); | 401 | lastword.empty(); |
402 | lastsizes[0] = laststartline = 0; | 402 | lastsizes[0] = laststartline = 0; |
@@ -407,6 +407,6 @@ int BuffDoc::openfile(QWidget* _parent, const char *src) | |||
407 | #endif | 407 | #endif |
408 | exp->locate(0); | 408 | exp->locate(0); |
409 | filt->setsource(exp); | 409 | filt->setsource(exp); |
410 | // //qDebug("BuffDoc:file opened"); | 410 | // //odebug << "BuffDoc:file opened" << oendl; |
411 | return 0; | 411 | return 0; |
412 | } | 412 | } |
diff --git a/noncore/apps/opie-reader/CDrawBuffer.cpp b/noncore/apps/opie-reader/CDrawBuffer.cpp index ec36fb2..b137ac3 100644 --- a/noncore/apps/opie-reader/CDrawBuffer.cpp +++ b/noncore/apps/opie-reader/CDrawBuffer.cpp | |||
@@ -40,7 +40,7 @@ void CDrawBuffer::setright(CDrawBuffer& rhs, int f) | |||
40 | CDrawBuffer& CDrawBuffer::operator=(CDrawBuffer& rhs) | 40 | CDrawBuffer& CDrawBuffer::operator=(CDrawBuffer& rhs) |
41 | { | 41 | { |
42 | int i; | 42 | int i; |
43 | // //qDebug("Trying 2"); | 43 | // //odebug << "Trying 2" << oendl; |
44 | len = rhs.len; | 44 | len = rhs.len; |
45 | m_maxstyle = rhs.m_maxstyle; | 45 | m_maxstyle = rhs.m_maxstyle; |
46 | m_ascent = rhs.m_ascent; | 46 | m_ascent = rhs.m_ascent; |
@@ -58,7 +58,7 @@ CDrawBuffer& CDrawBuffer::operator=(CDrawBuffer& rhs) | |||
58 | for (i = 0; rhs[i] != '\0'; i++) (*this)[i] = rhs[i]; | 58 | for (i = 0; rhs[i] != '\0'; i++) (*this)[i] = rhs[i]; |
59 | (*this)[i] = '\0'; | 59 | (*this)[i] = '\0'; |
60 | len = i; | 60 | len = i; |
61 | // //qDebug("Tried 2"); | 61 | // //odebug << "Tried 2" << oendl; |
62 | return *this; | 62 | return *this; |
63 | } | 63 | } |
64 | 64 | ||
@@ -208,7 +208,7 @@ int CDrawBuffer::width(int numchars, bool onscreen, int scwidth, unsigned char _ | |||
208 | else | 208 | else |
209 | { | 209 | { |
210 | QString nstr = str.mid(lastspace+1, nsp-lastspace); | 210 | QString nstr = str.mid(lastspace+1, nsp-lastspace); |
211 | // qDebug("str:%s: last:%d new:%d nstr:%s:", (const char*)str, lastspace, nsp, (const char*)nstr); | 211 | // odebug << "str:" << str << ": last:" << lastspace << " new:" << nsp << " nstr:" << nstr << ":" << oendl; |
212 | int lw = fm.width(nstr); | 212 | int lw = fm.width(nstr); |
213 | cx += lw; | 213 | cx += lw; |
214 | lastspace = nsp; | 214 | lastspace = nsp; |
@@ -317,7 +317,7 @@ void CDrawBuffer::render(QPainter* _p, int _y, bool _bMono, int _charWidth, int | |||
317 | CStyle currentstyle = textstart->style; | 317 | CStyle currentstyle = textstart->style; |
318 | QFont f((currentstyle.isMono() && fc->hasCourier()) ? fc->fixedfontname() : fc->name(), fc->getsize(currentstyle), (currentstyle.isBold()) ? QFont::Bold : QFont::Normal, (currentstyle.isItalic()) ); | 318 | QFont f((currentstyle.isMono() && fc->hasCourier()) ? fc->fixedfontname() : fc->name(), fc->getsize(currentstyle), (currentstyle.isBold()) ? QFont::Bold : QFont::Normal, (currentstyle.isItalic()) ); |
319 | //f.setUnderline(currentstyle.isUnderline()); | 319 | //f.setUnderline(currentstyle.isUnderline()); |
320 | //if (currentstyle.isUnderline()) qDebug("UNDERLINE"); | 320 | //if (currentstyle.isUnderline()) odebug << "UNDERLINE" << oendl; |
321 | _p->setFont(f); | 321 | _p->setFont(f); |
322 | QString str = text.mid(textstart->start, end-textstart->start); | 322 | QString str = text.mid(textstart->start, end-textstart->start); |
323 | #if defined(OPIE) || !defined(USEQPE) | 323 | #if defined(OPIE) || !defined(USEQPE) |
@@ -408,7 +408,7 @@ void CDrawBuffer::render(QPainter* _p, int _y, bool _bMono, int _charWidth, int | |||
408 | spacenumber++; | 408 | spacenumber++; |
409 | int nexttoadd = (extraspace*spacenumber+spaces/2)/spaces - spacesofar; | 409 | int nexttoadd = (extraspace*spacenumber+spaces/2)/spaces - spacesofar; |
410 | QString nstr = str.mid(lastspace+1, nsp-lastspace); | 410 | QString nstr = str.mid(lastspace+1, nsp-lastspace); |
411 | // qDebug("str:%s: last:%d new:%d nstr:%s:", (const char*)str, lastspace, nsp, (const char*)nstr); | 411 | // odebug << "str:" << str << ": last:" << lastspace << " new:" << nsp << " nstr:" << nstr << ":" << oendl; |
412 | int lw = fm.width(nstr); | 412 | int lw = fm.width(nstr); |
413 | _p->drawText( cx, _y+voffset, nstr); | 413 | _p->drawText( cx, _y+voffset, nstr); |
414 | cx += lw+nexttoadd; | 414 | cx += lw+nexttoadd; |
@@ -418,7 +418,7 @@ void CDrawBuffer::render(QPainter* _p, int _y, bool _bMono, int _charWidth, int | |||
418 | else | 418 | else |
419 | { | 419 | { |
420 | QString nstr = str.mid(lastspace+1, nsp-lastspace); | 420 | QString nstr = str.mid(lastspace+1, nsp-lastspace); |
421 | // qDebug("str:%s: last:%d new:%d nstr:%s:", (const char*)str, lastspace, nsp, (const char*)nstr); | 421 | // odebug << "str:" << str << ": last:" << lastspace << " new:" << nsp << " nstr:" << nstr << ":" << oendl; |
422 | int lw = fm.width(nstr); | 422 | int lw = fm.width(nstr); |
423 | _p->drawText( cx, _y+voffset, nstr); | 423 | _p->drawText( cx, _y+voffset, nstr); |
424 | cx += lw; | 424 | cx += lw; |
@@ -470,14 +470,14 @@ linkType CDrawBuffer::getLinkType(int numchars, size_t& tgt) | |||
470 | end = (textend != segs.end()) ? textend->start : len; | 470 | end = (textend != segs.end()) ? textend->start : len; |
471 | currentstyle = textstart->style; | 471 | currentstyle = textstart->style; |
472 | /* | 472 | /* |
473 | if (currentstyle.isPicture()) qDebug("Passed thru picture"); | 473 | if (currentstyle.isPicture()) odebug << "Passed thru picture" << oendl; |
474 | if (currentstyle.getLink()) qDebug("Passed thru link"); | 474 | if (currentstyle.getLink()) odebug << "Passed thru link" << oendl; |
475 | //qDebug("islink:%d - %d", numchars, end); | 475 | //odebug << "islink:" << numchars << " - " << end << "" << oendl; |
476 | */ | 476 | */ |
477 | textstart = textend; | 477 | textstart = textend; |
478 | } | 478 | } |
479 | while (textend != segs.end() && end <= numchars); | 479 | while (textend != segs.end() && end <= numchars); |
480 | // if (currentstyle.isPicture()) qDebug("Clicked on picture"); | 480 | // if (currentstyle.isPicture()) odebug << "Clicked on picture" << oendl; |
481 | if (currentstyle.getPictureLink()) | 481 | if (currentstyle.getPictureLink()) |
482 | { | 482 | { |
483 | tgt = currentstyle.getPictureLinkData(); | 483 | tgt = currentstyle.getPictureLinkData(); |
@@ -539,7 +539,7 @@ void CDrawBuffer::resize() | |||
539 | if (m_bSop) | 539 | if (m_bSop) |
540 | { | 540 | { |
541 | int xt = ((segs.begin()->style.getExtraSpace()+fc->getextraspace())*fc->getsize(segs.begin()->style)+5)/10; | 541 | int xt = ((segs.begin()->style.getExtraSpace()+fc->getextraspace())*fc->getsize(segs.begin()->style)+5)/10; |
542 | //qDebug("ExtraSpace:%d", xt); | 542 | //odebug << "ExtraSpace:" << xt << "" << oendl; |
543 | m_ascent += xt; | 543 | m_ascent += xt; |
544 | m_lineSpacing += xt; | 544 | m_lineSpacing += xt; |
545 | } | 545 | } |
diff --git a/noncore/apps/opie-reader/QTReader.cpp b/noncore/apps/opie-reader/QTReader.cpp index d64abb4..b356ba5 100644 --- a/noncore/apps/opie-reader/QTReader.cpp +++ b/noncore/apps/opie-reader/QTReader.cpp | |||
@@ -80,7 +80,7 @@ QTReader::QTReader( const QString& filename, QWidget *parent=0, const tchar *nam | |||
80 | m_fm(NULL) | 80 | m_fm(NULL) |
81 | { | 81 | { |
82 | init(); | 82 | init(); |
83 | // // qDebug("Load_file(1)"); | 83 | // // odebug << "Load_file(1)" << oendl; |
84 | load_file((const tchar*)filename); | 84 | load_file((const tchar*)filename); |
85 | } | 85 | } |
86 | */ | 86 | */ |
@@ -91,7 +91,7 @@ void QTReader::mouseMoveEvent(QMouseEvent* _e) | |||
91 | 91 | ||
92 | mouseUpOn = !(_e->pos().x() == -1); | 92 | mouseUpOn = !(_e->pos().x() == -1); |
93 | 93 | ||
94 | qDebug("MouseMove:[%d, %d]", _e->pos().x(), _e->pos().y()); | 94 | odebug << "MouseMove:[" << _e->pos().x() << ", " << _e->pos().y() << "]" << oendl; |
95 | } | 95 | } |
96 | */ | 96 | */ |
97 | long QTReader::real_delay() | 97 | long QTReader::real_delay() |
@@ -104,7 +104,7 @@ void QTReader::mousePressEvent( QMouseEvent* _e ) | |||
104 | buffdoc.unsuspend(); | 104 | buffdoc.unsuspend(); |
105 | if (_e->button() == RightButton) | 105 | if (_e->button() == RightButton) |
106 | { | 106 | { |
107 | //qDebug("MousePress"); | 107 | //odebug << "MousePress" << oendl; |
108 | mouseUpOn = false; | 108 | mouseUpOn = false; |
109 | if (m_swapmouse) | 109 | if (m_swapmouse) |
110 | { | 110 | { |
@@ -317,7 +317,7 @@ void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouse | |||
317 | if (t->width(i, true, width(), m_border) > tgt) | 317 | if (t->width(i, true, width(), m_border) > tgt) |
318 | { | 318 | { |
319 | wrd = toQString(t->data()+first, i - first); | 319 | wrd = toQString(t->data()+first, i - first); |
320 | // qDebug("Got %s", (const char *)wrd); | 320 | // odebug << "Got " << (const char *)wrd << "" << oendl; |
321 | break; | 321 | break; |
322 | } | 322 | } |
323 | while (!QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++; | 323 | while (!QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++; |
@@ -327,7 +327,7 @@ void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouse | |||
327 | } | 327 | } |
328 | if (!wrd.isEmpty()) | 328 | if (!wrd.isEmpty()) |
329 | { | 329 | { |
330 | //qDebug("Selected:%s", (const char*)wrd); | 330 | //odebug << "Selected:" << wrd << "" << oendl; |
331 | emit OnWordSelected(wrd, locnarray[lineno], (m_twotouch) ? wrd : toQString(textarray[lineno]->data())); | 331 | emit OnWordSelected(wrd, locnarray[lineno], (m_twotouch) ? wrd : toQString(textarray[lineno]->data())); |
332 | } | 332 | } |
333 | } | 333 | } |
@@ -339,7 +339,7 @@ void QTReader::mouseReleaseEvent( QMouseEvent* _e ) | |||
339 | { | 339 | { |
340 | if (mouseUpOn) | 340 | if (mouseUpOn) |
341 | { | 341 | { |
342 | // qDebug("MouseRelease"); | 342 | // odebug << "MouseRelease" << oendl; |
343 | if (_e->x() > width() - m_border) | 343 | if (_e->x() > width() - m_border) |
344 | { | 344 | { |
345 | locate(buffdoc.startSection()+((buffdoc.endSection()-buffdoc.startSection())*_e->y()+height()/2)/height()); | 345 | locate(buffdoc.startSection()+((buffdoc.endSection()-buffdoc.startSection())*_e->y()+height()/2)/height()); |
@@ -394,7 +394,7 @@ void QTReader::mouseReleaseEvent( QMouseEvent* _e ) | |||
394 | } | 394 | } |
395 | case ePicture: | 395 | case ePicture: |
396 | { | 396 | { |
397 | // qDebug("Picture:%x", tgt); | 397 | // odebug << "Picture:" << tgt << "" << oendl; |
398 | QImage* pm = buffdoc.getPicture(tgt); | 398 | QImage* pm = buffdoc.getPicture(tgt); |
399 | if (pm != NULL) | 399 | if (pm != NULL) |
400 | { | 400 | { |
@@ -410,7 +410,7 @@ void QTReader::mouseReleaseEvent( QMouseEvent* _e ) | |||
410 | case eNone: | 410 | case eNone: |
411 | break; | 411 | break; |
412 | default: | 412 | default: |
413 | // qDebug("Unknown linktype"); | 413 | // odebug << "Unknown linktype" << oendl; |
414 | return; | 414 | return; |
415 | } | 415 | } |
416 | if (m_swapmouse) | 416 | if (m_swapmouse) |
@@ -696,7 +696,7 @@ void QTReader::setautoscroll(bool _sc) | |||
696 | #ifdef _SCROLLPIPE | 696 | #ifdef _SCROLLPIPE |
697 | if (!m_pipetarget.isEmpty()) | 697 | if (!m_pipetarget.isEmpty()) |
698 | { | 698 | { |
699 | // qDebug("Opening pipe to %s", (const char*)m_pipetarget); | 699 | // odebug << "Opening pipe to " << m_pipetarget << "" << oendl; |
700 | m_pipeout = popen((const char*)m_pipetarget, "w"); | 700 | m_pipeout = popen((const char*)m_pipetarget, "w"); |
701 | m_isPaused = false; | 701 | m_isPaused = false; |
702 | } | 702 | } |
@@ -823,24 +823,24 @@ void QTReader::drawFonts( QPainter *p ) | |||
823 | { | 823 | { |
824 | if (bDoUpdates) | 824 | if (bDoUpdates) |
825 | { | 825 | { |
826 | //qDebug("How refreshing..."); | 826 | //odebug << "How refreshing..." << oendl; |
827 | if (buffdoc.empty()) return; | 827 | if (buffdoc.empty()) return; |
828 | setfont(); | 828 | setfont(); |
829 | if (m_lastwidth != width()) | 829 | if (m_lastwidth != width()) |
830 | { | 830 | { |
831 | // qDebug("Not Optimised %d", m_lastwidth); | 831 | // odebug << "Not Optimised " << m_lastwidth << "" << oendl; |
832 | m_lastwidth = width(); | 832 | m_lastwidth = width(); |
833 | m_lastheight = height(); | 833 | m_lastheight = height(); |
834 | buffdoc.setwidth(m_lastwidth-2*m_border); | 834 | buffdoc.setwidth(m_lastwidth-2*m_border); |
835 | locate(pagelocate()); | 835 | locate(pagelocate()); |
836 | // qDebug("Not Optimised %d", m_lastwidth); | 836 | // odebug << "Not Optimised " << m_lastwidth << "" << oendl; |
837 | } | 837 | } |
838 | else | 838 | else |
839 | { | 839 | { |
840 | int newht = height(); | 840 | int newht = height(); |
841 | if (m_lastheight > newht) | 841 | if (m_lastheight > newht) |
842 | { | 842 | { |
843 | // qDebug("Optimised < %d %d %d", numlines, m_lastheight, newht); | 843 | // odebug << "Optimised < " << numlines << " " << m_lastheight << " " << newht << "" << oendl; |
844 | int ypos = 0; | 844 | int ypos = 0; |
845 | for (int i = 0; i < numlines; i++) | 845 | for (int i = 0; i < numlines; i++) |
846 | { | 846 | { |
@@ -851,19 +851,19 @@ void QTReader::drawFonts( QPainter *p ) | |||
851 | break; | 851 | break; |
852 | } | 852 | } |
853 | } | 853 | } |
854 | // qDebug("Optimised < %d", numlines); | 854 | // odebug << "Optimised < " << numlines << "" << oendl; |
855 | m_lastheight = newht; | 855 | m_lastheight = newht; |
856 | } | 856 | } |
857 | else if (m_lastheight < newht) | 857 | else if (m_lastheight < newht) |
858 | { | 858 | { |
859 | // qDebug("Optimised > %d", numlines); | 859 | // odebug << "Optimised > " << numlines << "" << oendl; |
860 | int ypos = 0; | 860 | int ypos = 0; |
861 | for (int i = 0; i <= numlines; i++) | 861 | for (int i = 0; i <= numlines; i++) |
862 | { | 862 | { |
863 | ypos += textarray[i]->lineSpacing(); | 863 | ypos += textarray[i]->lineSpacing(); |
864 | } | 864 | } |
865 | fillbuffer(numlines+1, ypos, newht); | 865 | fillbuffer(numlines+1, ypos, newht); |
866 | // qDebug("Optimised > %d", numlines); | 866 | // odebug << "Optimised > " << numlines << "" << oendl; |
867 | } | 867 | } |
868 | if (numlines > 0) | 868 | if (numlines > 0) |
869 | { | 869 | { |
@@ -897,7 +897,7 @@ void QTReader::drawFonts( QPainter *p ) | |||
897 | /* | 897 | /* |
898 | else | 898 | else |
899 | { | 899 | { |
900 | qDebug("Not so refreshing..."); | 900 | odebug << "Not so refreshing..." << oendl; |
901 | } | 901 | } |
902 | */ | 902 | */ |
903 | } | 903 | } |
@@ -1028,7 +1028,7 @@ void QTReader::paintEvent( QPaintEvent * ) | |||
1028 | /* | 1028 | /* |
1029 | void QTReader::resizeEvent( QResizeEvent * ) | 1029 | void QTReader::resizeEvent( QResizeEvent * ) |
1030 | { | 1030 | { |
1031 | // // qDebug("resize:(%u,%u)", width(), height()); | 1031 | // // odebug << "resize:(" << width() << "," << height() << ")" << oendl; |
1032 | // bgroup->move( width()-bgroup->width(), 0 ); | 1032 | // bgroup->move( width()-bgroup->width(), 0 ); |
1033 | } | 1033 | } |
1034 | */ | 1034 | */ |
@@ -1053,11 +1053,11 @@ bool QTReader::locate(unsigned long n) { | |||
1053 | //printf("Locate\n"); | 1053 | //printf("Locate\n"); |
1054 | buffdoc.unsuspend(); | 1054 | buffdoc.unsuspend(); |
1055 | buffdoc.locate(n); | 1055 | buffdoc.locate(n); |
1056 | // // qDebug("&buffdoc.located"); | 1056 | // // odebug << "&buffdoc.located" << oendl; |
1057 | fillbuffer(); | 1057 | fillbuffer(); |
1058 | // // qDebug("&Buffer filled"); | 1058 | // // odebug << "&Buffer filled" << oendl; |
1059 | update(); | 1059 | update(); |
1060 | // // qDebug("&Located"); | 1060 | // // odebug << "&Located" << oendl; |
1061 | return true; | 1061 | return true; |
1062 | } | 1062 | } |
1063 | 1063 | ||
@@ -1117,12 +1117,12 @@ bool QTReader::fillbuffer(int reuse, int ht, int newht) | |||
1117 | 1117 | ||
1118 | void QTReader::dopagedn() | 1118 | void QTReader::dopagedn() |
1119 | { | 1119 | { |
1120 | // qDebug("HEIGHT(2):%d", m_lastheight); | 1120 | // odebug << "HEIGHT(2):" << m_lastheight << "" << oendl; |
1121 | buffdoc.unsuspend(); | 1121 | buffdoc.unsuspend(); |
1122 | int skip = 0, ypos = 0; | 1122 | int skip = 0, ypos = 0; |
1123 | if (locate() != mylastpos) | 1123 | if (locate() != mylastpos) |
1124 | { | 1124 | { |
1125 | ////qDebug("Jumping to %u", mylastpos); | 1125 | ////odebug << "Jumping to " << mylastpos << "" << oendl; |
1126 | jumpto(mylastpos); | 1126 | jumpto(mylastpos); |
1127 | } | 1127 | } |
1128 | CDrawBuffer* reusebuffer = textarray[numlines]; | 1128 | CDrawBuffer* reusebuffer = textarray[numlines]; |
@@ -1313,13 +1313,13 @@ bool QTReader::load_file(const char *newfile, unsigned int _lcn) | |||
1313 | buffdoc.setwidth(m_lastwidth-2*m_border); | 1313 | buffdoc.setwidth(m_lastwidth-2*m_border); |
1314 | bRC = true; | 1314 | bRC = true; |
1315 | buffdoc.setContinuous(m_continuousDocument); | 1315 | buffdoc.setContinuous(m_continuousDocument); |
1316 | // // qDebug("buffdoc.openfile done"); | 1316 | // // odebug << "buffdoc.openfile done" << oendl; |
1317 | locate(lcn); | 1317 | locate(lcn); |
1318 | // // qDebug("buffdoc.locate done"); | 1318 | // // odebug << "buffdoc.locate done" << oendl; |
1319 | } | 1319 | } |
1320 | setfilter(getfilter()); | 1320 | setfilter(getfilter()); |
1321 | update(); | 1321 | update(); |
1322 | // // qDebug("Updated"); | 1322 | // // odebug << "Updated" << oendl; |
1323 | return bRC; | 1323 | return bRC; |
1324 | } | 1324 | } |
1325 | 1325 | ||
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp index b072854..f18cb59 100644 --- a/noncore/apps/opie-reader/QTReaderApp.cpp +++ b/noncore/apps/opie-reader/QTReaderApp.cpp | |||
@@ -17,20 +17,48 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | |||
20 | #include "useqpe.h" | 21 | #include "useqpe.h" |
21 | #include <qregexp.h> | 22 | #include "QTReader.h" |
22 | #include <qclipboard.h> | 23 | #include "GraphicWin.h" |
23 | #include <qwidgetstack.h> | 24 | #include "Bkmks.h" |
25 | #include "cbkmkselector.h" | ||
26 | #include "infowin.h" | ||
27 | #include "ToolbarPrefs.h" | ||
28 | #include "Prefs.h" | ||
29 | #include "CAnnoEdit.h" | ||
30 | #include "QFloatBar.h" | ||
31 | #include "FixedFont.h" | ||
32 | #include "URLDialog.h" | ||
33 | #include "QTReaderApp.h" | ||
34 | #include "CDrawBuffer.h" | ||
35 | #include "Filedata.h" | ||
36 | #include "opie.h" | ||
37 | #include "names.h" | ||
38 | #include "CEncoding_tables.h" | ||
39 | #include "CloseDialog.h" | ||
40 | |||
41 | /* OPIE */ | ||
42 | #include <opie2/odebug.h> | ||
43 | #ifdef USEQPE | ||
44 | #include <qpe/menubutton.h> | ||
45 | #include <qpe/fontdatabase.h> | ||
46 | #include <qpe/global.h> | ||
47 | #include <qpe/applnk.h> | ||
48 | #include <qpe/config.h> | ||
49 | #include <qpe/qcopenvelope_qws.h> | ||
50 | #endif | ||
51 | |||
52 | /* QT */ | ||
24 | #ifdef USEQPE | 53 | #ifdef USEQPE |
25 | #include <qmenubar.h> | 54 | #include <qmenubar.h> |
26 | #include <qtoolbar.h> | 55 | #include <qtoolbar.h> |
27 | #endif | 56 | #endif |
57 | #include <qregexp.h> | ||
58 | #include <qclipboard.h> | ||
59 | #include <qwidgetstack.h> | ||
28 | #include <qmenubar.h> | 60 | #include <qmenubar.h> |
29 | #include <qtoolbar.h> | 61 | #include <qtoolbar.h> |
30 | #ifdef USEQPE | ||
31 | #include <qpe/menubutton.h> | ||
32 | #include <qpe/fontdatabase.h> | ||
33 | #endif | ||
34 | #include <qcombobox.h> | 62 | #include <qcombobox.h> |
35 | #include <qpopupmenu.h> | 63 | #include <qpopupmenu.h> |
36 | #include <qaction.h> | 64 | #include <qaction.h> |
@@ -39,33 +67,14 @@ | |||
39 | #include <qtoolbutton.h> | 67 | #include <qtoolbutton.h> |
40 | #include <qspinbox.h> | 68 | #include <qspinbox.h> |
41 | #include <qobjectlist.h> | 69 | #include <qobjectlist.h> |
42 | #ifdef USEQPE | ||
43 | #include <qpe/global.h> | ||
44 | #include <qpe/applnk.h> | ||
45 | #endif | ||
46 | #include <qfileinfo.h> | 70 | #include <qfileinfo.h> |
47 | #include <stdlib.h> //getenv | ||
48 | #include <qprogressbar.h> | 71 | #include <qprogressbar.h> |
49 | #ifdef USEQPE | ||
50 | #include <qpe/config.h> | ||
51 | #endif | ||
52 | #include <qbuttongroup.h> | 72 | #include <qbuttongroup.h> |
53 | #include <qradiobutton.h> | 73 | #include <qradiobutton.h> |
54 | #ifdef USEQPE | 74 | |
55 | #include <qpe/qcopenvelope_qws.h> | 75 | /* STD */ |
56 | #endif | 76 | #include <stdlib.h> //getenv |
57 | #include "QTReader.h" | 77 | |
58 | #include "GraphicWin.h" | ||
59 | #include "Bkmks.h" | ||
60 | #include "cbkmkselector.h" | ||
61 | #include "infowin.h" | ||
62 | #include "ToolbarPrefs.h" | ||
63 | #include "Prefs.h" | ||
64 | #include "CAnnoEdit.h" | ||
65 | #include "QFloatBar.h" | ||
66 | #include "FixedFont.h" | ||
67 | #include "URLDialog.h" | ||
68 | //#include <qpe/fontdatabase.h> | ||
69 | 78 | ||
70 | #ifdef USEQPE | 79 | #ifdef USEQPE |
71 | #include <qpe/resource.h> | 80 | #include <qpe/resource.h> |
@@ -75,14 +84,6 @@ | |||
75 | #include "qfiledialog.h" | 84 | #include "qfiledialog.h" |
76 | #endif | 85 | #endif |
77 | 86 | ||
78 | #include "QTReaderApp.h" | ||
79 | #include "CDrawBuffer.h" | ||
80 | #include "Filedata.h" | ||
81 | #include "opie.h" | ||
82 | #include "names.h" | ||
83 | #include "CEncoding_tables.h" | ||
84 | #include "CloseDialog.h" | ||
85 | |||
86 | bool CheckVersion(int&, int&, char&); | 87 | bool CheckVersion(int&, int&, char&); |
87 | 88 | ||
88 | #ifdef _WINDOWS | 89 | #ifdef _WINDOWS |
@@ -125,10 +126,10 @@ void QTReaderApp::listBkmkFiles() | |||
125 | 126 | ||
126 | QDir d = QDir::home(); // "/" | 127 | QDir d = QDir::home(); // "/" |
127 | if ( !d.cd(APPDIR) ) { // "/tmp" | 128 | if ( !d.cd(APPDIR) ) { // "/tmp" |
128 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 129 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; |
129 | d = QDir::home(); | 130 | d = QDir::home(); |
130 | d.mkdir(APPDIR); | 131 | d.mkdir(APPDIR); |
131 | d.cd(APPDIR); | 132 | d.cd(APPDIR); |
132 | } | 133 | } |
133 | 134 | ||
134 | 135 | ||
@@ -143,10 +144,10 @@ void QTReaderApp::listBkmkFiles() | |||
143 | 144 | ||
144 | while ( (fi=it.current()) ) { // for each file... | 145 | while ( (fi=it.current()) ) { // for each file... |
145 | 146 | ||
146 | bkmkselector->insertItem(fi->fileName()); | 147 | bkmkselector->insertItem(fi->fileName()); |
147 | cnt++; | 148 | cnt++; |
148 | 149 | ||
149 | //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); | 150 | //odebug << "" << fi->size() << " " << fi->fileName().data() << "" << oendl; |
150 | ++it; // goto next list element | 151 | ++it; // goto next list element |
151 | } | 152 | } |
152 | 153 | ||
@@ -157,16 +158,16 @@ void QTReaderApp::listBkmkFiles() | |||
157 | 158 | ||
158 | while(1) | 159 | while(1) |
159 | { | 160 | { |
160 | struct dirent* de; | 161 | struct dirent* de; |
161 | struct stat buf; | 162 | struct stat buf; |
162 | de = readdir(d); | 163 | de = readdir(d); |
163 | if (de == NULL) break; | 164 | if (de == NULL) break; |
164 | 165 | ||
165 | if (lstat((const char *)Global::applicationFileName(APPDIR,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) | 166 | if (lstat((const char *)Global::applicationFileName(APPDIR,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) |
166 | { | 167 | { |
167 | bkmkselector->insertItem(de->d_name); | 168 | bkmkselector->insertItem(de->d_name); |
168 | cnt++; | 169 | cnt++; |
169 | } | 170 | } |
170 | } | 171 | } |
171 | 172 | ||
172 | closedir(d); | 173 | closedir(d); |
@@ -176,7 +177,7 @@ void QTReaderApp::listBkmkFiles() | |||
176 | //tjw menu->hide(); | 177 | //tjw menu->hide(); |
177 | editorStack->raiseWidget( bkmkselector ); | 178 | editorStack->raiseWidget( bkmkselector ); |
178 | hidetoolbars(); | 179 | hidetoolbars(); |
179 | m_nBkmkAction = cRmBkmkFile; | 180 | m_nBkmkAction = cRmBkmkFile; |
180 | } | 181 | } |
181 | else | 182 | else |
182 | QMessageBox::information(this, PROGNAME, "No bookmark files"); | 183 | QMessageBox::information(this, PROGNAME, "No bookmark files"); |
@@ -193,16 +194,16 @@ void QTReaderApp::hidetoolbars() | |||
193 | if (regVisible) | 194 | if (regVisible) |
194 | { | 195 | { |
195 | #ifdef USEQPE | 196 | #ifdef USEQPE |
196 | Global::hideInputMethod(); | 197 | Global::hideInputMethod(); |
197 | #endif | 198 | #endif |
198 | regBar->hide(); | 199 | regBar->hide(); |
199 | } | 200 | } |
200 | if (searchVisible) | 201 | if (searchVisible) |
201 | { | 202 | { |
202 | #ifdef USEQPE | 203 | #ifdef USEQPE |
203 | Global::hideInputMethod(); | 204 | Global::hideInputMethod(); |
204 | #endif | 205 | #endif |
205 | searchBar->hide(); | 206 | searchBar->hide(); |
206 | } | 207 | } |
207 | } | 208 | } |
208 | 209 | ||
@@ -210,12 +211,12 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
210 | : QMainWindow( parent, name, f ), bFromDocView( FALSE ), m_dontSave(false), | 211 | : QMainWindow( parent, name, f ), bFromDocView( FALSE ), m_dontSave(false), |
211 | fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL) | 212 | fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL) |
212 | { | 213 | { |
213 | m_url_clipboard = false; | 214 | m_url_clipboard = false; |
214 | m_url_localfile = false; | 215 | m_url_localfile = false; |
215 | m_url_globalfile = false; | 216 | m_url_globalfile = false; |
216 | ftime(&m_lastkeytime); | 217 | ftime(&m_lastkeytime); |
217 | //// qDebug("Application directory = %s", (const tchar *)QPEApplication::documentDir()); | 218 | //// odebug << "Application directory = " << (const tchar *)QPEApplication::documentDir() << "" << oendl; |
218 | //// qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml")); | 219 | //// odebug << "Application directory = " << (const tchar *)Global::applicationFileName("uqtreader" << "" << oendl; |
219 | 220 | ||
220 | m_bcloseDisabled = true; | 221 | m_bcloseDisabled = true; |
221 | m_disableesckey = false; | 222 | m_disableesckey = false; |
@@ -223,8 +224,8 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
223 | pOpenlist = NULL; | 224 | pOpenlist = NULL; |
224 | // doc = 0; | 225 | // doc = 0; |
225 | 226 | ||
226 | m_fBkmksChanged = false; | 227 | m_fBkmksChanged = false; |
227 | 228 | ||
228 | QString lang = getenv( "LANG" ); | 229 | QString lang = getenv( "LANG" ); |
229 | QString rot = getenv( "QWS_DISPLAY" ); | 230 | QString rot = getenv( "QWS_DISPLAY" ); |
230 | 231 | ||
@@ -243,7 +244,7 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
243 | m_rot = 270; | 244 | m_rot = 270; |
244 | } | 245 | } |
245 | 246 | ||
246 | // qDebug("Initial Rotation(%d):%s", m_rot, (const char*)rot); | 247 | // odebug << "Initial Rotation(" << m_rot << "):" << rot << "" << oendl; |
247 | */ | 248 | */ |
248 | m_autogenstr = "^ *[A-Z].*[a-z] *$"; | 249 | m_autogenstr = "^ *[A-Z].*[a-z] *$"; |
249 | 250 | ||
@@ -260,13 +261,13 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
260 | #else | 261 | #else |
261 | QDir d = QDir::home(); // "/" | 262 | QDir d = QDir::home(); // "/" |
262 | if ( !d.cd(APPDIR) ) { // "/tmp" | 263 | if ( !d.cd(APPDIR) ) { // "/tmp" |
263 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 264 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; |
264 | d = QDir::home(); | 265 | d = QDir::home(); |
265 | d.mkdir(APPDIR); | 266 | d.mkdir(APPDIR); |
266 | d.cd(APPDIR); | 267 | d.cd(APPDIR); |
267 | } | 268 | } |
268 | QFileInfo fi(d, INIFILE); | 269 | QFileInfo fi(d, INIFILE); |
269 | // qDebug("Path:%s", (const char*)fi.absFilePath()); | 270 | // odebug << "Path:" << fi.absFilePath() << "" << oendl; |
270 | Config config(fi.absFilePath()); | 271 | Config config(fi.absFilePath()); |
271 | #endif | 272 | #endif |
272 | config.setGroup("Toolbar"); | 273 | config.setGroup("Toolbar"); |
@@ -355,8 +356,8 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
355 | 356 | ||
356 | // don't need the close visible, it is redundant... | 357 | // don't need the close visible, it is redundant... |
357 | importSelector->setCloseVisible( FALSE ); | 358 | importSelector->setCloseVisible( FALSE ); |
358 | */ | 359 | */ |
359 | // qDebug("Reading file list"); | 360 | // odebug << "Reading file list" << oendl; |
360 | readfilelist(); | 361 | readfilelist(); |
361 | 362 | ||
362 | reader = new QTReader( editorStack ); | 363 | reader = new QTReader( editorStack ); |
@@ -367,7 +368,7 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
367 | ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); | 368 | ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); |
368 | #endif | 369 | #endif |
369 | 370 | ||
370 | // qDebug("Reading config"); | 371 | // odebug << "Reading config" << oendl; |
371 | // Config config( APPDIR ); | 372 | // Config config( APPDIR ); |
372 | config.setGroup( "View" ); | 373 | config.setGroup( "View" ); |
373 | m_debounce = config.readNumEntry("Debounce", 0); | 374 | m_debounce = config.readNumEntry("Debounce", 0); |
@@ -437,13 +438,13 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
437 | reader->setBaseSize(config.readNumEntry( "Basesize", 10 )); | 438 | reader->setBaseSize(config.readNumEntry( "Basesize", 10 )); |
438 | 439 | ||
439 | #ifndef USEQPE | 440 | #ifndef USEQPE |
440 | config.setGroup( "Geometry" ); | 441 | config.setGroup( "Geometry" ); |
441 | setGeometry(0,0, | 442 | setGeometry(0,0, |
442 | config.readNumEntry( "width", QApplication::desktop()->width()/2 ), | 443 | config.readNumEntry( "width", QApplication::desktop()->width()/2 ), |
443 | config.readNumEntry( "height", QApplication::desktop()->height()/2 )); | 444 | config.readNumEntry( "height", QApplication::desktop()->height()/2 )); |
444 | move( | 445 | move( |
445 | config.readNumEntry( "x", 20 ), | 446 | config.readNumEntry( "x", 20 ), |
446 | config.readNumEntry( "y", 20 )); | 447 | config.readNumEntry( "y", 20 )); |
447 | #endif | 448 | #endif |
448 | 449 | ||
449 | 450 | ||
@@ -546,7 +547,7 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
546 | m_pageup_action = new QAction( tr( "Up" ), geticon( "up" ), QString::null, 0, this, 0 ); | 547 | m_pageup_action = new QAction( tr( "Up" ), geticon( "up" ), QString::null, 0, this, 0 ); |
547 | connect( m_pageup_action, SIGNAL( activated() ), this, SLOT( pageup() ) ); | 548 | connect( m_pageup_action, SIGNAL( activated() ), this, SLOT( pageup() ) ); |
548 | m_pageup_action->addTo( navigation ); | 549 | m_pageup_action->addTo( navigation ); |
549 | 550 | ||
550 | m_pagedn_action = new QAction( tr( "Down" ), geticon( "down" ), QString::null, 0, this, 0 ); | 551 | m_pagedn_action = new QAction( tr( "Down" ), geticon( "down" ), QString::null, 0, this, 0 ); |
551 | connect( m_pagedn_action, SIGNAL( activated() ), this, SLOT( pagedn() ) ); | 552 | connect( m_pagedn_action, SIGNAL( activated() ), this, SLOT( pagedn() ) ); |
552 | m_pagedn_action->addTo( navigation ); | 553 | m_pagedn_action->addTo( navigation ); |
@@ -727,10 +728,10 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
727 | 728 | ||
728 | #ifdef __ISEARCH | 729 | #ifdef __ISEARCH |
729 | connect( searchEdit, SIGNAL( textChanged(const QString&) ), | 730 | connect( searchEdit, SIGNAL( textChanged(const QString&) ), |
730 | this, SLOT( search(const QString&) ) ); | 731 | this, SLOT( search(const QString&) ) ); |
731 | #else | 732 | #else |
732 | connect( searchEdit, SIGNAL( returnPressed() ), | 733 | connect( searchEdit, SIGNAL( returnPressed() ), |
733 | this, SLOT( search() ) ); | 734 | this, SLOT( search() ) ); |
734 | #endif | 735 | #endif |
735 | QAction*a = new QAction( tr( "Find Next" ), geticon( "next" ), QString::null, 0, this, 0 ); | 736 | QAction*a = new QAction( tr( "Find Next" ), geticon( "next" ), QString::null, 0, this, 0 ); |
736 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); | 737 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); |
@@ -753,7 +754,7 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
753 | regBar->setStretchableWidget( regEdit ); | 754 | regBar->setStretchableWidget( regEdit ); |
754 | 755 | ||
755 | connect( regEdit, SIGNAL( returnPressed() ), | 756 | connect( regEdit, SIGNAL( returnPressed() ), |
756 | this, SLOT( do_regaction() ) ); | 757 | this, SLOT( do_regaction() ) ); |
757 | 758 | ||
758 | a = new QAction( tr( "Do Reg" ), geticon( "enter" ), QString::null, 0, this, 0 ); | 759 | a = new QAction( tr( "Do Reg" ), geticon( "enter" ), QString::null, 0, this, 0 ); |
759 | connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) ); | 760 | connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) ); |
@@ -769,89 +770,89 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
769 | 770 | ||
770 | m_fontBar->setHorizontalStretchable( TRUE ); | 771 | m_fontBar->setHorizontalStretchable( TRUE ); |
771 | 772 | ||
772 | // qDebug("Font selector"); | 773 | // odebug << "Font selector" << oendl; |
773 | m_fontSelector = new QComboBox(false, m_fontBar); | 774 | m_fontSelector = new QComboBox(false, m_fontBar); |
774 | m_fontBar->setStretchableWidget( m_fontSelector ); | 775 | m_fontBar->setStretchableWidget( m_fontSelector ); |
775 | { | 776 | { |
776 | #ifndef USEQPE | 777 | #ifndef USEQPE |
777 | QFontDatabase f; | 778 | QFontDatabase f; |
778 | #else | 779 | #else |
779 | FontDatabase f; | 780 | FontDatabase f; |
780 | #endif | 781 | #endif |
781 | QStringList flist = f.families(); | 782 | QStringList flist = f.families(); |
782 | bool realfont = false; | 783 | bool realfont = false; |
783 | for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) | 784 | for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) |
784 | { | 785 | { |
785 | if (reader->m_fontname == *nm) | 786 | if (reader->m_fontname == *nm) |
786 | { | 787 | { |
787 | realfont = true; | 788 | realfont = true; |
788 | } | 789 | } |
789 | if ((*nm).contains(FIXEDFONT,false)) reader->m_fontControl.hasCourier(true, *nm); | 790 | if ((*nm).contains(FIXEDFONT,false)) reader->m_fontControl.hasCourier(true, *nm); |
790 | } | 791 | } |
791 | if (!realfont) reader->m_fontname = flist[0]; | 792 | if (!realfont) reader->m_fontname = flist[0]; |
792 | } // delete the FontDatabase!!! | 793 | } // delete the FontDatabase!!! |
793 | connect( m_fontSelector, SIGNAL( activated(const QString&) ), | 794 | connect( m_fontSelector, SIGNAL( activated(const QString&) ), |
794 | this, SLOT( do_setfont(const QString&) ) ); | 795 | this, SLOT( do_setfont(const QString&) ) ); |
795 | connect( m_fontSelector, SIGNAL( activated(int) ), | 796 | connect( m_fontSelector, SIGNAL( activated(int) ), |
796 | this, SLOT( do_setencoding(int) ) ); | 797 | this, SLOT( do_setencoding(int) ) ); |
797 | 798 | ||
798 | m_fontBar->hide(); | 799 | m_fontBar->hide(); |
799 | m_fontVisible = false; | 800 | m_fontVisible = false; |
800 | #ifdef USEMSGS | 801 | #ifdef USEMSGS |
801 | connect(qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), | 802 | connect(qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), |
802 | this, SLOT( msgHandler(const QCString&,const QByteArray&) ) ); | 803 | this, SLOT( msgHandler(const QCString&,const QByteArray&) ) ); |
803 | #endif | 804 | #endif |
804 | // qDebug("Initing"); | 805 | // odebug << "Initing" << oendl; |
805 | reader->init(); | 806 | reader->init(); |
806 | // qDebug("Inited"); | 807 | // odebug << "Inited" << oendl; |
807 | // m_buttonAction[m_spaceTarget]->setOn(true); | 808 | // m_buttonAction[m_spaceTarget]->setOn(true); |
808 | // qDebug("fonting"); | 809 | // odebug << "fonting" << oendl; |
809 | do_setfont(reader->m_fontname); | 810 | do_setfont(reader->m_fontname); |
810 | if (!reader->m_lastfile.isEmpty()) | 811 | if (!reader->m_lastfile.isEmpty()) |
811 | { | 812 | { |
812 | //qDebug("doclnk"); | 813 | // odebug << "doclnk" << oendl; |
813 | //doc = new DocLnk(reader->m_lastfile); | 814 | // doc = new DocLnk(reader->m_lastfile); |
814 | //qDebug("doclnk done"); | 815 | // odebug << "doclnk done" << oendl; |
815 | if (pOpenlist != NULL) | 816 | if (pOpenlist != NULL) |
816 | { | 817 | { |
817 | 818 | ||
818 | /* | 819 | /* |
819 | int ind = 0; | 820 | int ind = 0; |
820 | Bkmk* p = (*pOpenlist)[ind]; | 821 | Bkmk* p = (*pOpenlist)[ind]; |
821 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) | 822 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) |
822 | { | 823 | { |
823 | p = (*pOpenlist)[++ind]; | 824 | p = (*pOpenlist)[++ind]; |
824 | } | 825 | } |
825 | */ | 826 | */ |
826 | Bkmk* p = NULL; | 827 | Bkmk* p = NULL; |
827 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) | 828 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) |
828 | { | 829 | { |
829 | p = iter.pContent(); | 830 | p = iter.pContent(); |
830 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) | 831 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) |
831 | { | 832 | { |
832 | break; | 833 | break; |
833 | } | 834 | } |
834 | // qDebug("Item:%s", (const char*)toQString(CFiledata(p->anno()).name())); | 835 | // odebug << "Item:" << toQString(CFiledata(p->anno()).name()) << "" << oendl; |
835 | p = NULL; | 836 | p = NULL; |
836 | } | 837 | } |
837 | if (p != NULL) | 838 | if (p != NULL) |
838 | { | 839 | { |
839 | //qDebug("openfrombkmk"); | 840 | // odebug << "openfrombkmk" << oendl; |
840 | if (!openfrombkmk(p)) | 841 | if (!openfrombkmk(p)) |
841 | showEditTools(); | 842 | showEditTools(); |
842 | } | 843 | } |
843 | else | 844 | else |
844 | { | 845 | { |
845 | //qDebug("openfile"); | 846 | // odebug << "openfile" << oendl; |
846 | openFile( reader->m_lastfile ); | 847 | openFile( reader->m_lastfile ); |
847 | } | 848 | } |
848 | } | 849 | } |
849 | else | 850 | else |
850 | { | 851 | { |
851 | // qDebug("Openfile 2"); | 852 | // odebug << "Openfile 2" << oendl; |
852 | if (!reader->m_lastfile.isEmpty()) | 853 | if (!reader->m_lastfile.isEmpty()) |
853 | openFile( reader->m_lastfile ); | 854 | openFile( reader->m_lastfile ); |
854 | } | 855 | } |
855 | } | 856 | } |
856 | else | 857 | else |
857 | { | 858 | { |
@@ -866,11 +867,11 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
866 | char minor = config.readNumEntry("Minor", 0); | 867 | char minor = config.readNumEntry("Minor", 0); |
867 | if (CheckVersion(major, bkmktype, minor)) | 868 | if (CheckVersion(major, bkmktype, minor)) |
868 | { | 869 | { |
869 | config.writeEntry("Major", major); | 870 | config.writeEntry("Major", major); |
870 | config.writeEntry("BkmkType", bkmktype); | 871 | config.writeEntry("BkmkType", bkmktype); |
871 | config.writeEntry("Minor", (int)minor); | 872 | config.writeEntry("Minor", (int)minor); |
872 | } | 873 | } |
873 | // qDebug("finished update"); | 874 | // odebug << "finished update" << oendl; |
874 | } | 875 | } |
875 | 876 | ||
876 | void QTReaderApp::addtoolbars(Config* config) | 877 | void QTReaderApp::addtoolbars(Config* config) |
@@ -879,19 +880,19 @@ void QTReaderApp::addtoolbars(Config* config) | |||
879 | 880 | ||
880 | if (fileBar != NULL) | 881 | if (fileBar != NULL) |
881 | { | 882 | { |
882 | if (fileBar != menubar) | 883 | if (fileBar != menubar) |
883 | { | 884 | { |
884 | fileBar->clear(); | 885 | fileBar->clear(); |
885 | } | 886 | } |
886 | else | 887 | else |
887 | { | 888 | { |
888 | m_preferences_action->removeFrom( filebar() ); | 889 | m_preferences_action->removeFrom( filebar() ); |
889 | m_open_action->removeFrom( filebar() ); | 890 | m_open_action->removeFrom( filebar() ); |
890 | m_close_action->removeFrom( filebar() ); | 891 | m_close_action->removeFrom( filebar() ); |
891 | m_info_action->removeFrom( filebar() ); | 892 | m_info_action->removeFrom( filebar() ); |
892 | m_touch_action->removeFrom( filebar() ); | 893 | m_touch_action->removeFrom( filebar() ); |
893 | m_find_action->removeFrom( filebar() ); | 894 | m_find_action->removeFrom( filebar() ); |
894 | } | 895 | } |
895 | } | 896 | } |
896 | 897 | ||
897 | m_preferences_action->addTo( filebar() ); | 898 | m_preferences_action->addTo( filebar() ); |
@@ -903,23 +904,23 @@ void QTReaderApp::addtoolbars(Config* config) | |||
903 | 904 | ||
904 | if (navBar != NULL) | 905 | if (navBar != NULL) |
905 | { | 906 | { |
906 | if ((navBar == fileBar) && (fileBar == menubar)) | 907 | if ((navBar == fileBar) && (fileBar == menubar)) |
907 | { | 908 | { |
908 | m_scrollButton->removeFrom( navbar() ); | 909 | m_scrollButton->removeFrom( navbar() ); |
909 | m_start_action->removeFrom( navbar() ); | 910 | m_start_action->removeFrom( navbar() ); |
910 | m_end_action->removeFrom( navbar() ); | 911 | m_end_action->removeFrom( navbar() ); |
911 | m_jump_action->removeFrom( navbar() ); | 912 | m_jump_action->removeFrom( navbar() ); |
912 | m_pageline_action->removeFrom( navbar() ); | 913 | m_pageline_action->removeFrom( navbar() ); |
913 | m_pageup_action->removeFrom( navbar() ); | 914 | m_pageup_action->removeFrom( navbar() ); |
914 | m_pagedn_action->removeFrom( navbar() ); | 915 | m_pagedn_action->removeFrom( navbar() ); |
915 | m_back_action->removeFrom( navbar() ); | 916 | m_back_action->removeFrom( navbar() ); |
916 | m_home_action->removeFrom( navbar() ); | 917 | m_home_action->removeFrom( navbar() ); |
917 | m_forward_action->removeFrom( navbar() ); | 918 | m_forward_action->removeFrom( navbar() ); |
918 | } | 919 | } |
919 | else if (navBar != fileBar) | 920 | else if (navBar != fileBar) |
920 | { | 921 | { |
921 | navBar->clear(); | 922 | navBar->clear(); |
922 | } | 923 | } |
923 | } | 924 | } |
924 | 925 | ||
925 | addnavbar(config, "Scroll", m_scrollButton); | 926 | addnavbar(config, "Scroll", m_scrollButton); |
@@ -938,19 +939,19 @@ void QTReaderApp::addtoolbars(Config* config) | |||
938 | 939 | ||
939 | if (viewBar != NULL) | 940 | if (viewBar != NULL) |
940 | { | 941 | { |
941 | if ((viewBar == fileBar) && (fileBar == menubar)) | 942 | if ((viewBar == fileBar) && (fileBar == menubar)) |
942 | { | 943 | { |
943 | m_actFullscreen->removeFrom( filebar() ); | 944 | m_actFullscreen->removeFrom( filebar() ); |
944 | m_zoomin_action->removeFrom( viewbar() ); | 945 | m_zoomin_action->removeFrom( viewbar() ); |
945 | m_zoomout_action->removeFrom( viewbar() ); | 946 | m_zoomout_action->removeFrom( viewbar() ); |
946 | m_setfont_action->removeFrom( viewbar() ); | 947 | m_setfont_action->removeFrom( viewbar() ); |
947 | m_setenc_action->removeFrom( viewbar() ); | 948 | m_setenc_action->removeFrom( viewbar() ); |
948 | m_setmono_action->removeFrom( viewbar() ); | 949 | m_setmono_action->removeFrom( viewbar() ); |
949 | } | 950 | } |
950 | else if (viewBar != fileBar) | 951 | else if (viewBar != fileBar) |
951 | { | 952 | { |
952 | viewBar->clear(); | 953 | viewBar->clear(); |
953 | } | 954 | } |
954 | } | 955 | } |
955 | 956 | ||
956 | addviewbar(config, "Fullscreen", m_actFullscreen); | 957 | addviewbar(config, "Fullscreen", m_actFullscreen); |
@@ -962,23 +963,23 @@ void QTReaderApp::addtoolbars(Config* config) | |||
962 | 963 | ||
963 | if (markBar != NULL) | 964 | if (markBar != NULL) |
964 | { | 965 | { |
965 | if ((markBar == fileBar) && (fileBar == menubar)) | 966 | if ((markBar == fileBar) && (fileBar == menubar)) |
966 | { | 967 | { |
967 | m_mark_action->removeFrom( markbar() ); | 968 | m_mark_action->removeFrom( markbar() ); |
968 | m_annotate_action->removeFrom( markbar()); | 969 | m_annotate_action->removeFrom( markbar()); |
969 | m_goto_action->removeFrom( markbar() ); | 970 | m_goto_action->removeFrom( markbar() ); |
970 | m_delete_action->removeFrom( markbar() ); | 971 | m_delete_action->removeFrom( markbar() ); |
971 | m_autogen_action->removeFrom( markbar() ); | 972 | m_autogen_action->removeFrom( markbar() ); |
972 | m_clear_action->removeFrom( markbar() ); | 973 | m_clear_action->removeFrom( markbar() ); |
973 | m_save_action->removeFrom( markbar() ); | 974 | m_save_action->removeFrom( markbar() ); |
974 | m_tidy_action->removeFrom( markbar() ); | 975 | m_tidy_action->removeFrom( markbar() ); |
975 | m_startBlock_action->removeFrom( markbar() ); | 976 | m_startBlock_action->removeFrom( markbar() ); |
976 | m_endBlock_action->removeFrom( markbar() ); | 977 | m_endBlock_action->removeFrom( markbar() ); |
977 | } | 978 | } |
978 | else if (markBar != fileBar) | 979 | else if (markBar != fileBar) |
979 | { | 980 | { |
980 | markBar->clear(); | 981 | markBar->clear(); |
981 | } | 982 | } |
982 | } | 983 | } |
983 | addmarkbar(config, "Mark", m_mark_action); | 984 | addmarkbar(config, "Mark", m_mark_action); |
984 | addmarkbar(config, "Annotate", m_annotate_action); | 985 | addmarkbar(config, "Annotate", m_annotate_action); |
@@ -992,26 +993,26 @@ void QTReaderApp::addtoolbars(Config* config) | |||
992 | addmarkbar(config, "Copy Block", m_endBlock_action); | 993 | addmarkbar(config, "Copy Block", m_endBlock_action); |
993 | if (checkbar(config, "Annotation indicator")) | 994 | if (checkbar(config, "Annotation indicator")) |
994 | { | 995 | { |
995 | if (m_bkmkAvail == NULL) | 996 | if (m_bkmkAvail == NULL) |
996 | { | 997 | { |
997 | m_bkmkAvail = new QAction( tr( "Annotation" ), geticon( "find" ), QString::null, 0, this, 0 ); | 998 | m_bkmkAvail = new QAction( tr( "Annotation" ), geticon( "find" ), QString::null, 0, this, 0 ); |
998 | connect( m_bkmkAvail, SIGNAL( activated() ), this, SLOT( showAnnotation() ) ); | 999 | connect( m_bkmkAvail, SIGNAL( activated() ), this, SLOT( showAnnotation() ) ); |
999 | 1000 | ||
1000 | m_bkmkAvail->setEnabled(false); | 1001 | m_bkmkAvail->setEnabled(false); |
1001 | } | 1002 | } |
1002 | QLabel *spacer = new QLabel(markBar, ""); | 1003 | QLabel *spacer = new QLabel(markBar, ""); |
1003 | markbar()->setStretchableWidget(spacer); | 1004 | markbar()->setStretchableWidget(spacer); |
1004 | m_bkmkAvail->removeFrom( markbar() ); | 1005 | m_bkmkAvail->removeFrom( markbar() ); |
1005 | m_bkmkAvail->addTo( markbar() ); | 1006 | m_bkmkAvail->addTo( markbar() ); |
1006 | } | 1007 | } |
1007 | else | 1008 | else |
1008 | { | 1009 | { |
1009 | if (m_bkmkAvail != NULL) | 1010 | if (m_bkmkAvail != NULL) |
1010 | { | 1011 | { |
1011 | m_bkmkAvail->removeFrom( markbar() ); | 1012 | m_bkmkAvail->removeFrom( markbar() ); |
1012 | delete m_bkmkAvail; | 1013 | delete m_bkmkAvail; |
1013 | m_bkmkAvail = NULL; | 1014 | m_bkmkAvail = NULL; |
1014 | } | 1015 | } |
1015 | } | 1016 | } |
1016 | } | 1017 | } |
1017 | 1018 | ||
@@ -1025,21 +1026,21 @@ QToolBar* QTReaderApp::filebar() | |||
1025 | { | 1026 | { |
1026 | if (fileBar == NULL) | 1027 | if (fileBar == NULL) |
1027 | { | 1028 | { |
1028 | switch (m_tbpol) | 1029 | switch (m_tbpol) |
1029 | { | 1030 | { |
1030 | case cesSingle: | 1031 | case cesSingle: |
1031 | // qDebug("Setting filebar to menubar"); | 1032 | // odebug << "Setting filebar to menubar" << oendl; |
1032 | fileBar = menubar; | 1033 | fileBar = menubar; |
1033 | break; | 1034 | break; |
1034 | default: | 1035 | default: |
1035 | qDebug("Incorrect toolbar policy set"); | 1036 | odebug << "Incorrect toolbar policy set" << oendl; |
1036 | case cesMenuTool: | 1037 | case cesMenuTool: |
1037 | case cesMultiple: | 1038 | case cesMultiple: |
1038 | // qDebug("Creating new file bar"); | 1039 | // odebug << "Creating new file bar" << oendl; |
1039 | fileBar = new QToolBar("File", this, m_tbposition); | 1040 | fileBar = new QToolBar("File", this, m_tbposition); |
1040 | break; | 1041 | break; |
1041 | } | 1042 | } |
1042 | //fileBar->setHorizontalStretchable( true ); | 1043 | // fileBar->setHorizontalStretchable( true ); |
1043 | } | 1044 | } |
1044 | return fileBar; | 1045 | return fileBar; |
1045 | } | 1046 | } |
@@ -1047,18 +1048,18 @@ QToolBar* QTReaderApp::viewbar() | |||
1047 | { | 1048 | { |
1048 | if (viewBar == NULL) | 1049 | if (viewBar == NULL) |
1049 | { | 1050 | { |
1050 | switch (m_tbpol) | 1051 | switch (m_tbpol) |
1051 | { | 1052 | { |
1052 | case cesMultiple: | 1053 | case cesMultiple: |
1053 | viewBar = new QToolBar("View", this, m_tbposition); | 1054 | viewBar = new QToolBar("View", this, m_tbposition); |
1054 | break; | 1055 | break; |
1055 | default: | 1056 | default: |
1056 | qDebug("Incorrect toolbar policy set"); | 1057 | odebug << "Incorrect toolbar policy set" << oendl; |
1057 | case cesSingle: | 1058 | case cesSingle: |
1058 | case cesMenuTool: | 1059 | case cesMenuTool: |
1059 | viewBar = fileBar; | 1060 | viewBar = fileBar; |
1060 | break; | 1061 | break; |
1061 | } | 1062 | } |
1062 | } | 1063 | } |
1063 | return viewBar; | 1064 | return viewBar; |
1064 | } | 1065 | } |
@@ -1066,20 +1067,20 @@ QToolBar* QTReaderApp::navbar() | |||
1066 | { | 1067 | { |
1067 | if (navBar == NULL) | 1068 | if (navBar == NULL) |
1068 | { | 1069 | { |
1069 | switch (m_tbpol) | 1070 | switch (m_tbpol) |
1070 | { | 1071 | { |
1071 | case cesMultiple: | 1072 | case cesMultiple: |
1072 | // qDebug("Creating new nav bar"); | 1073 | // odebug << "Creating new nav bar" << oendl; |
1073 | navBar = new QToolBar("Navigation", this, m_tbposition); | 1074 | navBar = new QToolBar("Navigation", this, m_tbposition); |
1074 | break; | 1075 | break; |
1075 | default: | 1076 | default: |
1076 | qDebug("Incorrect toolbar policy set"); | 1077 | odebug << "Incorrect toolbar policy set" << oendl; |
1077 | case cesSingle: | 1078 | case cesSingle: |
1078 | case cesMenuTool: | 1079 | case cesMenuTool: |
1079 | navBar = fileBar; | 1080 | navBar = fileBar; |
1080 | // qDebug("Setting navbar to filebar"); | 1081 | // odebug << "Setting navbar to filebar" << oendl; |
1081 | break; | 1082 | break; |
1082 | } | 1083 | } |
1083 | } | 1084 | } |
1084 | return navBar; | 1085 | return navBar; |
1085 | } | 1086 | } |
@@ -1087,18 +1088,18 @@ QToolBar* QTReaderApp::markbar() | |||
1087 | { | 1088 | { |
1088 | if (markBar == NULL) | 1089 | if (markBar == NULL) |
1089 | { | 1090 | { |
1090 | switch (m_tbpol) | 1091 | switch (m_tbpol) |
1091 | { | 1092 | { |
1092 | case cesMultiple: | 1093 | case cesMultiple: |
1093 | markBar = new QToolBar("Marks", this, m_tbposition); | 1094 | markBar = new QToolBar("Marks", this, m_tbposition); |
1094 | break; | 1095 | break; |
1095 | default: | 1096 | default: |
1096 | qDebug("Incorrect toolbar policy set"); | 1097 | odebug << "Incorrect toolbar policy set" << oendl; |
1097 | case cesSingle: | 1098 | case cesSingle: |
1098 | case cesMenuTool: | 1099 | case cesMenuTool: |
1099 | markBar = fileBar; | 1100 | markBar = fileBar; |
1100 | break; | 1101 | break; |
1101 | } | 1102 | } |
1102 | } | 1103 | } |
1103 | return markBar; | 1104 | return markBar; |
1104 | } | 1105 | } |
@@ -1127,336 +1128,336 @@ void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data) | |||
1127 | { | 1128 | { |
1128 | QString msg = QString::fromUtf8(_msg); | 1129 | QString msg = QString::fromUtf8(_msg); |
1129 | 1130 | ||
1130 | //// qDebug("Received:%s", (const char*)msg); | 1131 | //// odebug << "Received:" << msg << "" << oendl; |
1131 | 1132 | ||
1132 | QDataStream stream( _data, IO_ReadOnly ); | 1133 | QDataStream stream( _data, IO_ReadOnly ); |
1133 | if ( msg == "info(QString)" ) | 1134 | if ( msg == "info(QString)" ) |
1134 | { | 1135 | { |
1135 | QString info; | 1136 | QString info; |
1136 | stream >> info; | 1137 | stream >> info; |
1137 | QMessageBox::information(this, PROGNAME, info); | 1138 | QMessageBox::information(this, PROGNAME, info); |
1138 | } | 1139 | } |
1139 | else if ( msg == "Update(int)" ) | 1140 | else if ( msg == "Update(int)" ) |
1140 | { | 1141 | { |
1141 | int info; | 1142 | int info; |
1142 | stream >> info; | 1143 | stream >> info; |
1143 | if (info) | 1144 | if (info) |
1144 | { | 1145 | { |
1145 | reader->bDoUpdates = true; | 1146 | reader->bDoUpdates = true; |
1146 | reader->refresh(); | 1147 | reader->refresh(); |
1147 | } | 1148 | } |
1148 | else | 1149 | else |
1149 | { | 1150 | { |
1150 | reader->bDoUpdates = false; | 1151 | reader->bDoUpdates = false; |
1151 | } | 1152 | } |
1152 | } | 1153 | } |
1153 | else if ( msg == "warn(QString)" ) | 1154 | else if ( msg == "warn(QString)" ) |
1154 | { | 1155 | { |
1155 | QString info; | 1156 | QString info; |
1156 | stream >> info; | 1157 | stream >> info; |
1157 | QMessageBox::warning(this, PROGNAME, info); | 1158 | QMessageBox::warning(this, PROGNAME, info); |
1158 | } | 1159 | } |
1159 | else if ( msg == "exit()" ) | 1160 | else if ( msg == "exit()" ) |
1160 | { | 1161 | { |
1161 | m_dontSave = true; | 1162 | m_dontSave = true; |
1162 | close(); | 1163 | close(); |
1163 | } | 1164 | } |
1164 | else if ( msg == "pageDown()" ) | 1165 | else if ( msg == "pageDown()" ) |
1165 | { | 1166 | { |
1166 | reader->dopagedn(); | 1167 | reader->dopagedn(); |
1167 | } | 1168 | } |
1168 | else if ( msg == "pageUp()" ) | 1169 | else if ( msg == "pageUp()" ) |
1169 | { | 1170 | { |
1170 | reader->dopageup(); | 1171 | reader->dopageup(); |
1171 | } | 1172 | } |
1172 | else if ( msg == "lineDown()" ) | 1173 | else if ( msg == "lineDown()" ) |
1173 | { | 1174 | { |
1174 | reader->lineDown(); | 1175 | reader->lineDown(); |
1175 | } | 1176 | } |
1176 | else if ( msg == "lineUp()" ) | 1177 | else if ( msg == "lineUp()" ) |
1177 | { | 1178 | { |
1178 | reader->lineUp(); | 1179 | reader->lineUp(); |
1179 | } | 1180 | } |
1180 | else if ( msg == "showText()" ) | 1181 | else if ( msg == "showText()" ) |
1181 | { | 1182 | { |
1182 | showEditTools(); | 1183 | showEditTools(); |
1183 | } | 1184 | } |
1184 | else if ( msg == "home()" ) | 1185 | else if ( msg == "home()" ) |
1185 | { | 1186 | { |
1186 | reader->goHome(); | 1187 | reader->goHome(); |
1187 | } | 1188 | } |
1188 | else if ( msg == "back()" ) | 1189 | else if ( msg == "back()" ) |
1189 | { | 1190 | { |
1190 | reader->goBack(); | 1191 | reader->goBack(); |
1191 | } | 1192 | } |
1192 | else if ( msg == "forward()" ) | 1193 | else if ( msg == "forward()" ) |
1193 | { | 1194 | { |
1194 | reader->goForward(); | 1195 | reader->goForward(); |
1195 | } | 1196 | } |
1196 | else if ( msg == "File/Open(QString)" ) | 1197 | else if ( msg == "File/Open(QString)" ) |
1197 | { | 1198 | { |
1198 | QString info; | 1199 | QString info; |
1199 | stream >> info; | 1200 | stream >> info; |
1200 | openFile( info ); | 1201 | openFile( info ); |
1201 | } | 1202 | } |
1202 | else if ( msg == "File/Info()" ) | 1203 | else if ( msg == "File/Info()" ) |
1203 | { | 1204 | { |
1204 | showinfo(); | 1205 | showinfo(); |
1205 | } | 1206 | } |
1206 | else if ( msg == "File/Action(QString)" ) | 1207 | else if ( msg == "File/Action(QString)" ) |
1207 | { | 1208 | { |
1208 | QString info; | 1209 | QString info; |
1209 | stream >> info; | 1210 | stream >> info; |
1210 | m_spaceTarget = ActNameToInt(info); | 1211 | m_spaceTarget = ActNameToInt(info); |
1211 | } | 1212 | } |
1212 | else if ( msg == "Navigation/Scroll(int)" ) | 1213 | else if ( msg == "Navigation/Scroll(int)" ) |
1213 | { | 1214 | { |
1214 | int info; | 1215 | int info; |
1215 | stream >> info; | 1216 | stream >> info; |
1216 | autoScroll(info); | 1217 | autoScroll(info); |
1217 | } | 1218 | } |
1218 | 1219 | ||
1219 | else if ( msg == "Navigation/GotoStart()" ) | 1220 | else if ( msg == "Navigation/GotoStart()" ) |
1220 | { | 1221 | { |
1221 | gotoStart(); | 1222 | gotoStart(); |
1222 | } | 1223 | } |
1223 | else if ( msg == "Navigation/GotoEnd()" ) | 1224 | else if ( msg == "Navigation/GotoEnd()" ) |
1224 | { | 1225 | { |
1225 | gotoEnd(); | 1226 | gotoEnd(); |
1226 | } | 1227 | } |
1227 | else if ( msg == "Navigation/Jump(int)" ) | 1228 | else if ( msg == "Navigation/Jump(int)" ) |
1228 | { | 1229 | { |
1229 | int info; | 1230 | int info; |
1230 | stream >> info; | 1231 | stream >> info; |
1231 | reader->locate(info); | 1232 | reader->locate(info); |
1232 | } | 1233 | } |
1233 | else if ( msg == "Navigation/Page/LineScroll(int)" ) | 1234 | else if ( msg == "Navigation/Page/LineScroll(int)" ) |
1234 | { | 1235 | { |
1235 | int info; | 1236 | int info; |
1236 | stream >> info; | 1237 | stream >> info; |
1237 | pagemode(info); | 1238 | pagemode(info); |
1238 | } | 1239 | } |
1239 | else if ( msg == "Navigation/SetOverlap(int)" ) | 1240 | else if ( msg == "Navigation/SetOverlap(int)" ) |
1240 | { | 1241 | { |
1241 | int info; | 1242 | int info; |
1242 | stream >> info; | 1243 | stream >> info; |
1243 | reader->m_overlap = info; | 1244 | reader->m_overlap = info; |
1244 | } | 1245 | } |
1245 | else if ( msg == "Navigation/SetMargin(int)" ) | 1246 | else if ( msg == "Navigation/SetMargin(int)" ) |
1246 | { | 1247 | { |
1247 | int info; | 1248 | int info; |
1248 | stream >> info; | 1249 | stream >> info; |
1249 | do_margin(info); | 1250 | do_margin(info); |
1250 | } | 1251 | } |
1251 | else if ( msg == "File/SetDictionary(QString)" ) | 1252 | else if ( msg == "File/SetDictionary(QString)" ) |
1252 | { | 1253 | { |
1253 | QString info; | 1254 | QString info; |
1254 | stream >> info; | 1255 | stream >> info; |
1255 | do_settarget(info); | 1256 | do_settarget(info); |
1256 | } | 1257 | } |
1257 | #ifdef _SCROLLPIPE | 1258 | #ifdef _SCROLLPIPE |
1258 | else if ( msg == "File/SetScrollTarget(QString)" ) | 1259 | else if ( msg == "File/SetScrollTarget(QString)" ) |
1259 | { | 1260 | { |
1260 | QString info; | 1261 | QString info; |
1261 | stream >> info; | 1262 | stream >> info; |
1262 | reader->m_pipetarget = info; | 1263 | reader->m_pipetarget = info; |
1263 | } | 1264 | } |
1264 | #endif | 1265 | #endif |
1265 | else if ( msg == "File/Two/OneTouch(int)" ) | 1266 | else if ( msg == "File/Two/OneTouch(int)" ) |
1266 | { | 1267 | { |
1267 | int info; | 1268 | int info; |
1268 | stream >> info; | 1269 | stream >> info; |
1269 | setTwoTouch(info); | 1270 | setTwoTouch(info); |
1270 | } | 1271 | } |
1271 | else if ( msg == "Target/Annotation(int)" ) | 1272 | else if ( msg == "Target/Annotation(int)" ) |
1272 | { | 1273 | { |
1273 | int info; | 1274 | int info; |
1274 | stream >> info; | 1275 | stream >> info; |
1275 | OnAnnotation(info); | 1276 | OnAnnotation(info); |
1276 | } | 1277 | } |
1277 | else if ( msg == "Target/Dictionary(int)" ) | 1278 | else if ( msg == "Target/Dictionary(int)" ) |
1278 | { | 1279 | { |
1279 | int info; | 1280 | int info; |
1280 | stream >> info; | 1281 | stream >> info; |
1281 | OnDictionary(info); | 1282 | OnDictionary(info); |
1282 | } | 1283 | } |
1283 | else if ( msg == "Target/Clipboard(int)" ) | 1284 | else if ( msg == "Target/Clipboard(int)" ) |
1284 | { | 1285 | { |
1285 | int info; | 1286 | int info; |
1286 | stream >> info; | 1287 | stream >> info; |
1287 | OnClipboard(info); | 1288 | OnClipboard(info); |
1288 | } | 1289 | } |
1289 | else if ( msg == "File/Find(QString)" ) | 1290 | else if ( msg == "File/Find(QString)" ) |
1290 | { | 1291 | { |
1291 | QString info; | 1292 | QString info; |
1292 | stream >> info; | 1293 | stream >> info; |
1293 | QRegExp arg(info); | 1294 | QRegExp arg(info); |
1294 | size_t pos = reader->pagelocate(); | 1295 | size_t pos = reader->pagelocate(); |
1295 | size_t start = pos; | 1296 | size_t start = pos; |
1296 | CDrawBuffer test(&(reader->m_fontControl)); | 1297 | CDrawBuffer test(&(reader->m_fontControl)); |
1297 | reader->getline(&test); | 1298 | reader->getline(&test); |
1298 | while (arg.match(toQString(test.data())) == -1) | 1299 | while (arg.match(toQString(test.data())) == -1) |
1299 | { | 1300 | { |
1300 | pos = reader->locate(); | 1301 | pos = reader->locate(); |
1301 | if (!reader->getline(&test)) | 1302 | if (!reader->getline(&test)) |
1302 | { | 1303 | { |
1303 | QMessageBox::information(this, PROGNAME, QString("Can't find\n")+info); | 1304 | QMessageBox::information(this, PROGNAME, QString("Can't find\n")+info); |
1304 | pos = start; | 1305 | pos = start; |
1305 | break; | 1306 | break; |
1306 | } | 1307 | } |
1307 | } | 1308 | } |
1308 | reader->locate(pos); | 1309 | reader->locate(pos); |
1309 | } | 1310 | } |
1310 | else if ( msg == "File/Fullscreen(int)" ) | 1311 | else if ( msg == "File/Fullscreen(int)" ) |
1311 | { | 1312 | { |
1312 | int info; | 1313 | int info; |
1313 | stream >> info; | 1314 | stream >> info; |
1314 | setfullscreen(info); | 1315 | setfullscreen(info); |
1315 | } | 1316 | } |
1316 | else if ( msg == "File/Continuous(int)" ) | 1317 | else if ( msg == "File/Continuous(int)" ) |
1317 | { | 1318 | { |
1318 | int info; | 1319 | int info; |
1319 | stream >> info; | 1320 | stream >> info; |
1320 | setcontinuous(info); | 1321 | setcontinuous(info); |
1321 | } | 1322 | } |
1322 | else if ( msg == "Markup(QString)" ) | 1323 | else if ( msg == "Markup(QString)" ) |
1323 | { | 1324 | { |
1324 | QString info; | 1325 | QString info; |
1325 | stream >> info; | 1326 | stream >> info; |
1326 | if (info == "Auto") | 1327 | if (info == "Auto") |
1327 | { | 1328 | { |
1328 | autofmt(true); | 1329 | autofmt(true); |
1329 | } | 1330 | } |
1330 | if (info == "None") | 1331 | if (info == "None") |
1331 | { | 1332 | { |
1332 | autofmt(false); | 1333 | autofmt(false); |
1333 | textfmt(false); | 1334 | textfmt(false); |
1334 | striphtml(false); | 1335 | striphtml(false); |
1335 | peanut(false); | 1336 | peanut(false); |
1336 | } | 1337 | } |
1337 | if (info == "Text") | 1338 | if (info == "Text") |
1338 | { | 1339 | { |
1339 | textfmt(true); | 1340 | textfmt(true); |
1340 | } | 1341 | } |
1341 | if (info == "HTML") | 1342 | if (info == "HTML") |
1342 | { | 1343 | { |
1343 | striphtml(true); | 1344 | striphtml(true); |
1344 | } | 1345 | } |
1345 | if (info == "Peanut/PML") | 1346 | if (info == "Peanut/PML") |
1346 | { | 1347 | { |
1347 | peanut(true); | 1348 | peanut(true); |
1348 | } | 1349 | } |
1349 | } | 1350 | } |
1350 | else if ( msg == "Layout/StripCR(int)" ) | 1351 | else if ( msg == "Layout/StripCR(int)" ) |
1351 | { | 1352 | { |
1352 | int info; | 1353 | int info; |
1353 | stream >> info; | 1354 | stream >> info; |
1354 | stripcr(info); | 1355 | stripcr(info); |
1355 | } | 1356 | } |
1356 | else if ( msg == "Layout/Dehyphen(int)" ) | 1357 | else if ( msg == "Layout/Dehyphen(int)" ) |
1357 | { | 1358 | { |
1358 | int info; | 1359 | int info; |
1359 | stream >> info; | 1360 | stream >> info; |
1360 | dehyphen(info); | 1361 | dehyphen(info); |
1361 | } | 1362 | } |
1362 | else if ( msg == "Layout/Depluck(int)" ) | 1363 | else if ( msg == "Layout/Depluck(int)" ) |
1363 | { | 1364 | { |
1364 | int info; | 1365 | int info; |
1365 | stream >> info; | 1366 | stream >> info; |
1366 | depluck(info); | 1367 | depluck(info); |
1367 | } | 1368 | } |
1368 | else if ( msg == "Layout/Dejpluck(int)" ) | 1369 | else if ( msg == "Layout/Dejpluck(int)" ) |
1369 | { | 1370 | { |
1370 | int info; | 1371 | int info; |
1371 | stream >> info; | 1372 | stream >> info; |
1372 | dejpluck(info); | 1373 | dejpluck(info); |
1373 | } | 1374 | } |
1374 | else if ( msg == "Layout/SingleSpace(int)" ) | 1375 | else if ( msg == "Layout/SingleSpace(int)" ) |
1375 | { | 1376 | { |
1376 | int info; | 1377 | int info; |
1377 | stream >> info; | 1378 | stream >> info; |
1378 | onespace(info); | 1379 | onespace(info); |
1379 | } | 1380 | } |
1380 | #ifdef REPALM | 1381 | #ifdef REPALM |
1381 | else if ( msg == "Layout/Repalm(int)" ) | 1382 | else if ( msg == "Layout/Repalm(int)" ) |
1382 | { | 1383 | { |
1383 | int info; | 1384 | int info; |
1384 | stream >> info; | 1385 | stream >> info; |
1385 | repalm(info); | 1386 | repalm(info); |
1386 | } | 1387 | } |
1387 | #endif | 1388 | #endif |
1388 | else if ( msg == "Layout/Unindent(int)" ) | 1389 | else if ( msg == "Layout/Unindent(int)" ) |
1389 | { | 1390 | { |
1390 | int info; | 1391 | int info; |
1391 | stream >> info; | 1392 | stream >> info; |
1392 | unindent(info); | 1393 | unindent(info); |
1393 | } | 1394 | } |
1394 | else if ( msg == "Layout/Re-paragraph(int)" ) | 1395 | else if ( msg == "Layout/Re-paragraph(int)" ) |
1395 | { | 1396 | { |
1396 | int info; | 1397 | int info; |
1397 | stream >> info; | 1398 | stream >> info; |
1398 | repara(info); | 1399 | repara(info); |
1399 | } | 1400 | } |
1400 | else if ( msg == "Layout/DoubleSpace(int)" ) | 1401 | else if ( msg == "Layout/DoubleSpace(int)" ) |
1401 | { | 1402 | { |
1402 | int info; | 1403 | int info; |
1403 | stream >> info; | 1404 | stream >> info; |
1404 | dblspce(info); | 1405 | dblspce(info); |
1405 | } | 1406 | } |
1406 | else if ( msg == "Layout/Indent(int)" ) | 1407 | else if ( msg == "Layout/Indent(int)" ) |
1407 | { | 1408 | { |
1408 | int info; | 1409 | int info; |
1409 | stream >> info; | 1410 | stream >> info; |
1410 | reader->bindenter = info; | 1411 | reader->bindenter = info; |
1411 | reader->setfilter(reader->getfilter()); | 1412 | reader->setfilter(reader->getfilter()); |
1412 | } | 1413 | } |
1413 | else if ( msg == "Layout/Remap(int)" ) | 1414 | else if ( msg == "Layout/Remap(int)" ) |
1414 | { | 1415 | { |
1415 | int info; | 1416 | int info; |
1416 | stream >> info; | 1417 | stream >> info; |
1417 | remap(info); | 1418 | remap(info); |
1418 | } | 1419 | } |
1419 | else if ( msg == "Layout/Embolden(int)" ) | 1420 | else if ( msg == "Layout/Embolden(int)" ) |
1420 | { | 1421 | { |
1421 | int info; | 1422 | int info; |
1422 | stream >> info; | 1423 | stream >> info; |
1423 | embolden(info); | 1424 | embolden(info); |
1424 | } | 1425 | } |
1425 | else if ( msg == "Format/Ideogram/Word(int)" ) | 1426 | else if ( msg == "Format/Ideogram/Word(int)" ) |
1426 | { | 1427 | { |
1427 | int info; | 1428 | int info; |
1428 | stream >> info; | 1429 | stream >> info; |
1429 | monospace(info); | 1430 | monospace(info); |
1430 | } | 1431 | } |
1431 | else if ( msg == "Format/SetWidth(int)" ) | 1432 | else if ( msg == "Format/SetWidth(int)" ) |
1432 | { | 1433 | { |
1433 | int info; | 1434 | int info; |
1434 | stream >> info; | 1435 | stream >> info; |
1435 | reader->m_charpc = info; | 1436 | reader->m_charpc = info; |
1436 | reader->setfont(); | 1437 | reader->setfont(); |
1437 | reader->refresh(); | 1438 | reader->refresh(); |
1438 | } | 1439 | } |
1439 | else if ( msg == "Format/SetFont(QString,int)" ) | 1440 | else if ( msg == "Format/SetFont(QString,int)" ) |
1440 | { | 1441 | { |
1441 | QString fontname; | 1442 | QString fontname; |
1442 | int size; | 1443 | int size; |
1443 | stream >> fontname; | 1444 | stream >> fontname; |
1444 | stream >> size; | 1445 | stream >> size; |
1445 | setfontHelper(fontname, size); | 1446 | setfontHelper(fontname, size); |
1446 | } | 1447 | } |
1447 | else if ( msg == "Marks/Autogen(QString)" ) | 1448 | else if ( msg == "Marks/Autogen(QString)" ) |
1448 | { | 1449 | { |
1449 | QString info; | 1450 | QString info; |
1450 | stream >> info; | 1451 | stream >> info; |
1451 | do_autogen(info); | 1452 | do_autogen(info); |
1452 | } | 1453 | } |
1453 | else if ( msg == "File/StartBlock()" ) | 1454 | else if ( msg == "File/StartBlock()" ) |
1454 | { | 1455 | { |
1455 | editMark(); | 1456 | editMark(); |
1456 | } | 1457 | } |
1457 | else if ( msg == "File/CopyBlock()" ) | 1458 | else if ( msg == "File/CopyBlock()" ) |
1458 | { | 1459 | { |
1459 | editCopy(); | 1460 | editCopy(); |
1460 | } | 1461 | } |
1461 | } | 1462 | } |
1462 | #endif | 1463 | #endif |
@@ -1464,7 +1465,7 @@ ActionTypes QTReaderApp::ActNameToInt(const QString& _enc) | |||
1464 | { | 1465 | { |
1465 | for (int i = 0; i < MAX_ACTIONS; i++) | 1466 | for (int i = 0; i < MAX_ACTIONS; i++) |
1466 | { | 1467 | { |
1467 | if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i; | 1468 | if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i; |
1468 | } | 1469 | } |
1469 | return cesAutoScroll; | 1470 | return cesAutoScroll; |
1470 | } | 1471 | } |
@@ -1481,7 +1482,7 @@ void QTReaderApp::setfullscreen(bool sfs) | |||
1481 | 1482 | ||
1482 | void QTReaderApp::buttonActionSelected(QAction* _a) | 1483 | void QTReaderApp::buttonActionSelected(QAction* _a) |
1483 | { | 1484 | { |
1484 | //// qDebug("es:%x : %s (%u)", _a, (const char *)(_a->text()), ActNameToInt(_a->text())); | 1485 | //// odebug << "es:" << _a << " : " << (const char *)(_a->text()) << " (" << ActNameToInt(_a->text()) << ")" << oendl; |
1485 | m_spaceTarget = ActNameToInt(_a->text()); | 1486 | m_spaceTarget = ActNameToInt(_a->text()); |
1486 | } | 1487 | } |
1487 | 1488 | ||
@@ -1507,9 +1508,9 @@ void QTReaderApp::zoomout() | |||
1507 | 1508 | ||
1508 | void QTReaderApp::clearBkmkList() | 1509 | void QTReaderApp::clearBkmkList() |
1509 | { | 1510 | { |
1510 | delete pBkmklist; | 1511 | delete pBkmklist; |
1511 | pBkmklist = NULL; | 1512 | pBkmklist = NULL; |
1512 | m_fBkmksChanged = false; | 1513 | m_fBkmksChanged = false; |
1513 | } | 1514 | } |
1514 | 1515 | ||
1515 | void QTReaderApp::fileClose() | 1516 | void QTReaderApp::fileClose() |
@@ -1517,42 +1518,42 @@ void QTReaderApp::fileClose() | |||
1517 | CCloseDialog* cd = new CCloseDialog(reader->m_string, false, this); | 1518 | CCloseDialog* cd = new CCloseDialog(reader->m_string, false, this); |
1518 | if (cd->exec()) | 1519 | if (cd->exec()) |
1519 | { | 1520 | { |
1520 | if (pOpenlist != NULL) | 1521 | if (pOpenlist != NULL) |
1521 | { | 1522 | { |
1522 | int ind = 0; | 1523 | int ind = 0; |
1523 | Bkmk* p = (*pOpenlist)[ind]; | 1524 | Bkmk* p = (*pOpenlist)[ind]; |
1524 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) | 1525 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) |
1525 | { | 1526 | { |
1526 | p = (*pOpenlist)[++ind]; | 1527 | p = (*pOpenlist)[++ind]; |
1527 | } | 1528 | } |
1528 | if (p != NULL) pOpenlist->erase(ind); | 1529 | if (p != NULL) pOpenlist->erase(ind); |
1529 | if (cd->delFile()) | 1530 | if (cd->delFile()) |
1530 | { | 1531 | { |
1531 | unlink((const char*)reader->m_lastfile); | 1532 | unlink((const char*)reader->m_lastfile); |
1532 | } | 1533 | } |
1533 | if (cd->delMarks()) | 1534 | if (cd->delMarks()) |
1534 | { | 1535 | { |
1535 | #ifndef USEQPE | 1536 | #ifndef USEQPE |
1536 | QDir d = QDir::home(); // "/" | 1537 | QDir d = QDir::home(); // "/" |
1537 | d.cd(APPDIR); | 1538 | d.cd(APPDIR); |
1538 | d.remove(reader->m_string); | 1539 | d.remove(reader->m_string); |
1539 | #else /* USEQPE */ | 1540 | #else /* USEQPE */ |
1540 | unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); | 1541 | unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); |
1541 | #endif /* USEQPE */ | 1542 | #endif /* USEQPE */ |
1542 | } | 1543 | } |
1543 | if (cd->delConfig()) | 1544 | if (cd->delConfig()) |
1544 | { | 1545 | { |
1545 | #ifndef USEQPE | 1546 | #ifndef USEQPE |
1546 | QDir d = QDir::home(); // "/" | 1547 | QDir d = QDir::home(); // "/" |
1547 | d.cd(APPDIR "/configs"); | 1548 | d.cd(APPDIR "/configs"); |
1548 | d.remove(reader->m_string); | 1549 | d.remove(reader->m_string); |
1549 | #else /* USEQPE */ | 1550 | #else /* USEQPE */ |
1550 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",reader->m_string)); | 1551 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",reader->m_string)); |
1551 | #endif /* USEQPE */ | 1552 | #endif /* USEQPE */ |
1552 | } | 1553 | } |
1553 | } | 1554 | } |
1554 | 1555 | ||
1555 | fileOpen2(); | 1556 | fileOpen2(); |
1556 | } | 1557 | } |
1557 | delete cd; | 1558 | delete cd; |
1558 | } | 1559 | } |
@@ -1563,41 +1564,41 @@ void QTReaderApp::updatefileinfo() | |||
1563 | if (reader->m_lastfile.isEmpty()) return; | 1564 | if (reader->m_lastfile.isEmpty()) return; |
1564 | tchar* nm = fromQString(reader->m_string); | 1565 | tchar* nm = fromQString(reader->m_string); |
1565 | tchar* fl = fromQString(reader->m_lastfile); | 1566 | tchar* fl = fromQString(reader->m_lastfile); |
1566 | // qDebug("Lastfile:%x", fl); | 1567 | // odebug << "Lastfile:" << fl << "" << oendl; |
1567 | bool notadded = true; | 1568 | bool notadded = true; |
1568 | if (pOpenlist == NULL) pOpenlist = new CList<Bkmk>; | 1569 | if (pOpenlist == NULL) pOpenlist = new CList<Bkmk>; |
1569 | else | 1570 | else |
1570 | { | 1571 | { |
1571 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) | 1572 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) |
1572 | { | 1573 | { |
1573 | if (ustrcmp(CFiledata(iter->anno()).name(), fl) == 0) | 1574 | if (ustrcmp(CFiledata(iter->anno()).name(), fl) == 0) |
1574 | { | 1575 | { |
1575 | iter->value(reader->pagelocate()); | 1576 | iter->value(reader->pagelocate()); |
1576 | unsigned short dlen; | 1577 | unsigned short dlen; |
1577 | unsigned char* data; | 1578 | unsigned char* data; |
1578 | CFiledata fd(iter->anno()); | 1579 | CFiledata fd(iter->anno()); |
1579 | reader->setSaveData(data, dlen, fd.content(), fd.length()); | 1580 | reader->setSaveData(data, dlen, fd.content(), fd.length()); |
1580 | // qDebug("Filedata(1):%u, %u", fd.length(), dlen); | 1581 | // odebug << "Filedata(1):" << fd.length() << ", " << dlen << "" << oendl; |
1581 | // getstate(data, dlen); | 1582 | // getstate(data, dlen); |
1582 | iter->setAnno(data, dlen); | 1583 | iter->setAnno(data, dlen); |
1583 | notadded = false; | 1584 | notadded = false; |
1584 | delete [] data; | 1585 | delete [] data; |
1585 | break; | 1586 | break; |
1586 | } | 1587 | } |
1587 | } | 1588 | } |
1588 | } | 1589 | } |
1589 | // qDebug("Added?:%x", notadded); | 1590 | // odebug << "Added?:" << notadded << "" << oendl; |
1590 | if (notadded) | 1591 | if (notadded) |
1591 | { | 1592 | { |
1592 | struct stat fnstat; | 1593 | struct stat fnstat; |
1593 | stat((const char *)reader->m_lastfile, &fnstat); | 1594 | stat((const char *)reader->m_lastfile, &fnstat); |
1594 | CFiledata fd(fnstat.st_mtime, fl); | 1595 | CFiledata fd(fnstat.st_mtime, fl); |
1595 | unsigned short dlen; | 1596 | unsigned short dlen; |
1596 | unsigned char* data; | 1597 | unsigned char* data; |
1597 | reader->setSaveData(data, dlen, fd.content(), fd.length()); | 1598 | reader->setSaveData(data, dlen, fd.content(), fd.length()); |
1598 | pOpenlist->push_front(Bkmk(nm, data, dlen, reader->pagelocate())); | 1599 | pOpenlist->push_front(Bkmk(nm, data, dlen, reader->pagelocate())); |
1599 | //qDebug("Filedata(2):%u, %u", fd.length(), dlen); | 1600 | // odebug << "Filedata(2):" << fd.length() << ", " << dlen << "" << oendl; |
1600 | delete [] data; | 1601 | delete [] data; |
1601 | } | 1602 | } |
1602 | delete [] nm; | 1603 | delete [] nm; |
1603 | delete [] fl; | 1604 | delete [] fl; |
@@ -1611,7 +1612,7 @@ void QTReaderApp::fileOpen() | |||
1611 | if (regVisible) regBar->hide(); | 1612 | if (regVisible) regBar->hide(); |
1612 | if (searchVisible) searchBar->hide(); | 1613 | if (searchVisible) searchBar->hide(); |
1613 | */ | 1614 | */ |
1614 | // qDebug("fileOpen"); | 1615 | // odebug << "fileOpen" << oendl; |
1615 | // if (!reader->m_lastfile.isEmpty()) | 1616 | // if (!reader->m_lastfile.isEmpty()) |
1616 | updatefileinfo(); | 1617 | updatefileinfo(); |
1617 | fileOpen2(); | 1618 | fileOpen2(); |
@@ -1621,14 +1622,14 @@ void QTReaderApp::fileOpen2() | |||
1621 | { | 1622 | { |
1622 | if (pBkmklist != NULL) | 1623 | if (pBkmklist != NULL) |
1623 | { | 1624 | { |
1624 | if (m_fBkmksChanged) | 1625 | if (m_fBkmksChanged) |
1625 | { | 1626 | { |
1626 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) | 1627 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) |
1627 | savebkmks(); | 1628 | savebkmks(); |
1628 | } | 1629 | } |
1629 | delete pBkmklist; | 1630 | delete pBkmklist; |
1630 | pBkmklist = NULL; | 1631 | pBkmklist = NULL; |
1631 | m_fBkmksChanged = false; | 1632 | m_fBkmksChanged = false; |
1632 | } | 1633 | } |
1633 | reader->disableAutoscroll(); | 1634 | reader->disableAutoscroll(); |
1634 | /* | 1635 | /* |
@@ -1638,21 +1639,21 @@ void QTReaderApp::fileOpen2() | |||
1638 | bool usebrowser = true; | 1639 | bool usebrowser = true; |
1639 | if (pOpenlist != NULL) | 1640 | if (pOpenlist != NULL) |
1640 | { | 1641 | { |
1641 | m_nBkmkAction = cOpenFile; | 1642 | m_nBkmkAction = cOpenFile; |
1642 | if (listbkmk(pOpenlist, "Browse")) usebrowser = false; | 1643 | if (listbkmk(pOpenlist, "Browse")) usebrowser = false; |
1643 | } | 1644 | } |
1644 | if (usebrowser) | 1645 | if (usebrowser) |
1645 | { | 1646 | { |
1646 | QString fn = usefilebrowser(); | 1647 | QString fn = usefilebrowser(); |
1647 | //qApp->processEvents(); | 1648 | // qApp->processEvents(); |
1648 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) | 1649 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) |
1649 | { | 1650 | { |
1650 | openFile(fn); | 1651 | openFile(fn); |
1651 | } | 1652 | } |
1652 | reader->setFocus(); | 1653 | reader->setFocus(); |
1653 | } | 1654 | } |
1654 | // reader->refresh(); | 1655 | // reader->refresh(); |
1655 | // qDebug("HEIGHT:%d", reader->m_lastheight); | 1656 | // odebug << "HEIGHT:" << reader->m_lastheight << "" << oendl; |
1656 | } | 1657 | } |
1657 | 1658 | ||
1658 | QString QTReaderApp::usefilebrowser() | 1659 | QString QTReaderApp::usefilebrowser() |
@@ -1662,17 +1663,17 @@ QString QTReaderApp::usefilebrowser() | |||
1662 | return s; | 1663 | return s; |
1663 | #else | 1664 | #else |
1664 | fileBrowser* fb = new fileBrowser(false, this,"OpieReader",!m_bFloatingDialog, | 1665 | fileBrowser* fb = new fileBrowser(false, this,"OpieReader",!m_bFloatingDialog, |
1665 | 0, | 1666 | 0, |
1666 | // WStyle_Customize | WStyle_NoBorderEx, | 1667 | // WStyle_Customize | WStyle_NoBorderEx, |
1667 | "*", QFileInfo(reader->m_lastfile).dirPath(true)); | 1668 | "*", QFileInfo(reader->m_lastfile).dirPath(true)); |
1668 | 1669 | ||
1669 | 1670 | ||
1670 | QString fn; | 1671 | QString fn; |
1671 | if (fb->exec()) | 1672 | if (fb->exec()) |
1672 | { | 1673 | { |
1673 | fn = fb->getCurrentFile(); | 1674 | fn = fb->getCurrentFile(); |
1674 | } | 1675 | } |
1675 | // qDebug("Selected %s", (const char*)fn); | 1676 | // odebug << "Selected " << fn << "" << oendl; |
1676 | delete fb; | 1677 | delete fb; |
1677 | showEditTools(); | 1678 | showEditTools(); |
1678 | return fn; | 1679 | return fn; |
@@ -1693,7 +1694,7 @@ void QTReaderApp::showprefs() | |||
1693 | { | 1694 | { |
1694 | CPrefs* prefwin = new CPrefs(!m_bFloatingDialog, this); | 1695 | CPrefs* prefwin = new CPrefs(!m_bFloatingDialog, this); |
1695 | 1696 | ||
1696 | prefwin->twotouch(m_twoTouch); | 1697 | prefwin->twotouch(m_twoTouch); |
1697 | prefwin->propfontchange(m_propogatefontchange); | 1698 | prefwin->propfontchange(m_propogatefontchange); |
1698 | prefwin->StripCR(reader->bstripcr); | 1699 | prefwin->StripCR(reader->bstripcr); |
1699 | prefwin->Dehyphen(reader->bdehyphen); | 1700 | prefwin->Dehyphen(reader->bdehyphen); |
@@ -1710,23 +1711,23 @@ void QTReaderApp::showprefs() | |||
1710 | prefwin->Indent(reader->bindenter); | 1711 | prefwin->Indent(reader->bindenter); |
1711 | if (reader->bautofmt) | 1712 | if (reader->bautofmt) |
1712 | { | 1713 | { |
1713 | prefwin->Markup(0); | 1714 | prefwin->Markup(0); |
1714 | } | 1715 | } |
1715 | else if (reader->btextfmt) | 1716 | else if (reader->btextfmt) |
1716 | { | 1717 | { |
1717 | prefwin->Markup(2); | 1718 | prefwin->Markup(2); |
1718 | } | 1719 | } |
1719 | else if (reader->bstriphtml) | 1720 | else if (reader->bstriphtml) |
1720 | { | 1721 | { |
1721 | prefwin->Markup(3); | 1722 | prefwin->Markup(3); |
1722 | } | 1723 | } |
1723 | else if (reader->bpeanut) | 1724 | else if (reader->bpeanut) |
1724 | { | 1725 | { |
1725 | prefwin->Markup(4); | 1726 | prefwin->Markup(4); |
1726 | } | 1727 | } |
1727 | else | 1728 | else |
1728 | { | 1729 | { |
1729 | prefwin->Markup(1); | 1730 | prefwin->Markup(1); |
1730 | } | 1731 | } |
1731 | prefwin->Depluck(reader->bdepluck); | 1732 | prefwin->Depluck(reader->bdepluck); |
1732 | prefwin->Dejpluck(reader->bdejpluck); | 1733 | prefwin->Dejpluck(reader->bdejpluck); |
@@ -1768,89 +1769,89 @@ void QTReaderApp::showprefs() | |||
1768 | 1769 | ||
1769 | if (prefwin->exec()) | 1770 | if (prefwin->exec()) |
1770 | { | 1771 | { |
1771 | m_twoTouch = prefwin->twotouch(); | 1772 | m_twoTouch = prefwin->twotouch(); |
1772 | reader->setTwoTouch(m_twoTouch); | 1773 | reader->setTwoTouch(m_twoTouch); |
1773 | m_touch_action->setOn(m_twoTouch); | 1774 | m_touch_action->setOn(m_twoTouch); |
1774 | 1775 | ||
1775 | reader->bstripcr = prefwin->StripCR(); | 1776 | reader->bstripcr = prefwin->StripCR(); |
1776 | reader->bdehyphen = prefwin->Dehyphen(); | 1777 | reader->bdehyphen = prefwin->Dehyphen(); |
1777 | reader->bonespace = prefwin->SingleSpace(); | 1778 | reader->bonespace = prefwin->SingleSpace(); |
1778 | reader->bunindent = prefwin->Unindent(); | 1779 | reader->bunindent = prefwin->Unindent(); |
1779 | reader->brepara = prefwin->Reparagraph(); | 1780 | reader->brepara = prefwin->Reparagraph(); |
1780 | reader->bdblspce = prefwin->DoubleSpace(); | 1781 | reader->bdblspce = prefwin->DoubleSpace(); |
1781 | reader->bremap = prefwin->Remap(); | 1782 | reader->bremap = prefwin->Remap(); |
1782 | reader->bmakebold = prefwin->Embolden(); | 1783 | reader->bmakebold = prefwin->Embolden(); |
1783 | reader->bfulljust = prefwin->FullJustify(); | 1784 | reader->bfulljust = prefwin->FullJustify(); |
1784 | reader->setextraspace(prefwin->ParaLead()); | 1785 | reader->setextraspace(prefwin->ParaLead()); |
1785 | reader->setlead(prefwin->LineLead()); | 1786 | reader->setlead(prefwin->LineLead()); |
1786 | reader->m_border = prefwin->Margin(); | 1787 | reader->m_border = prefwin->Margin(); |
1787 | reader->bindenter = prefwin->Indent(); | 1788 | reader->bindenter = prefwin->Indent(); |
1788 | reader->bautofmt = reader->btextfmt = reader->bstriphtml = reader->bpeanut = false; | 1789 | reader->bautofmt = reader->btextfmt = reader->bstriphtml = reader->bpeanut = false; |
1789 | switch (prefwin->Markup()) | 1790 | switch (prefwin->Markup()) |
1790 | { | 1791 | { |
1791 | case 0: | 1792 | case 0: |
1792 | reader->bautofmt = true; | 1793 | reader->bautofmt = true; |
1793 | break; | 1794 | break; |
1794 | case 1: | 1795 | case 1: |
1795 | break; | 1796 | break; |
1796 | case 2: | 1797 | case 2: |
1797 | reader->btextfmt = true; | 1798 | reader->btextfmt = true; |
1798 | break; | 1799 | break; |
1799 | case 3: | 1800 | case 3: |
1800 | reader->bstriphtml = true; | 1801 | reader->bstriphtml = true; |
1801 | break; | 1802 | break; |
1802 | case 4: | 1803 | case 4: |
1803 | reader->bpeanut = true; | 1804 | reader->bpeanut = true; |
1804 | break; | 1805 | break; |
1805 | default: | 1806 | default: |
1806 | qDebug("Format out of range"); | 1807 | odebug << "Format out of range" << oendl; |
1807 | } | 1808 | } |
1808 | reader->bdepluck = prefwin->Depluck(); | 1809 | reader->bdepluck = prefwin->Depluck(); |
1809 | reader->bdejpluck = prefwin->Dejpluck(); | 1810 | reader->bdejpluck = prefwin->Dejpluck(); |
1810 | reader->setContinuous(prefwin->Continuous()); | 1811 | reader->setContinuous(prefwin->Continuous()); |
1811 | 1812 | ||
1812 | m_spaceTarget = (ActionTypes)prefwin->spaceAction(); | 1813 | m_spaceTarget = (ActionTypes)prefwin->spaceAction(); |
1813 | m_escapeTarget = (ActionTypes)prefwin->escapeAction(); | 1814 | m_escapeTarget = (ActionTypes)prefwin->escapeAction(); |
1814 | m_returnTarget = (ActionTypes)prefwin->returnAction(); | 1815 | m_returnTarget = (ActionTypes)prefwin->returnAction(); |
1815 | m_leftTarget = (ActionTypes)prefwin->leftAction(); | 1816 | m_leftTarget = (ActionTypes)prefwin->leftAction(); |
1816 | m_rightTarget = (ActionTypes)prefwin->rightAction(); | 1817 | m_rightTarget = (ActionTypes)prefwin->rightAction(); |
1817 | m_upTarget = (ActionTypes)prefwin->upAction(); | 1818 | m_upTarget = (ActionTypes)prefwin->upAction(); |
1818 | m_downTarget = (ActionTypes)prefwin->downAction(); | 1819 | m_downTarget = (ActionTypes)prefwin->downAction(); |
1819 | m_leftScroll = prefwin->leftScroll(); | 1820 | m_leftScroll = prefwin->leftScroll(); |
1820 | m_rightScroll = prefwin->rightScroll(); | 1821 | m_rightScroll = prefwin->rightScroll(); |
1821 | m_upScroll = prefwin->upScroll(); | 1822 | m_upScroll = prefwin->upScroll(); |
1822 | m_downScroll = prefwin->downScroll(); | 1823 | m_downScroll = prefwin->downScroll(); |
1823 | 1824 | ||
1824 | m_targetapp = prefwin->dictApplication(); | 1825 | m_targetapp = prefwin->dictApplication(); |
1825 | m_targetmsg = prefwin->dictMessage(); | 1826 | m_targetmsg = prefwin->dictMessage(); |
1826 | 1827 | ||
1827 | m_doAnnotation = prefwin->miscannotation(); | 1828 | m_doAnnotation = prefwin->miscannotation(); |
1828 | m_doDictionary = prefwin->miscdictionary(); | 1829 | m_doDictionary = prefwin->miscdictionary(); |
1829 | m_doClipboard = prefwin->miscclipboard(); | 1830 | m_doClipboard = prefwin->miscclipboard(); |
1830 | reader->m_swapmouse = prefwin->SwapMouse(); | 1831 | reader->m_swapmouse = prefwin->SwapMouse(); |
1831 | reader->setBaseSize(prefwin->gfxsize()); | 1832 | reader->setBaseSize(prefwin->gfxsize()); |
1832 | reader->m_overlap = prefwin->pageoverlap(); | 1833 | reader->m_overlap = prefwin->pageoverlap(); |
1833 | reader->m_bMonoSpaced = prefwin->ideogram(); | 1834 | reader->m_bMonoSpaced = prefwin->ideogram(); |
1834 | m_setmono_action->setOn(reader->m_bMonoSpaced); | 1835 | m_setmono_action->setOn(reader->m_bMonoSpaced); |
1835 | reader->m_encd = prefwin->encoding(); | 1836 | reader->m_encd = prefwin->encoding(); |
1836 | reader->m_charpc = prefwin->ideogramwidth(); | 1837 | reader->m_charpc = prefwin->ideogramwidth(); |
1837 | 1838 | ||
1838 | if ( | 1839 | if ( |
1839 | reader->m_fontname != prefwin->Font() | 1840 | reader->m_fontname != prefwin->Font() |
1840 | || | 1841 | || |
1841 | m_propogatefontchange != prefwin->propfontchange()) | 1842 | m_propogatefontchange != prefwin->propfontchange()) |
1842 | { | 1843 | { |
1843 | m_propogatefontchange = prefwin->propfontchange(); | 1844 | m_propogatefontchange = prefwin->propfontchange(); |
1844 | setfontHelper(prefwin->Font()); | 1845 | setfontHelper(prefwin->Font()); |
1845 | } | 1846 | } |
1846 | delete prefwin; | 1847 | delete prefwin; |
1847 | reader->setfilter(reader->getfilter()); | 1848 | reader->setfilter(reader->getfilter()); |
1848 | reader->refresh(); | 1849 | reader->refresh(); |
1849 | 1850 | ||
1850 | } | 1851 | } |
1851 | else | 1852 | else |
1852 | { | 1853 | { |
1853 | delete prefwin; | 1854 | delete prefwin; |
1854 | } | 1855 | } |
1855 | } | 1856 | } |
1856 | 1857 | ||
@@ -1859,16 +1860,16 @@ void QTReaderApp::showtoolbarprefs() | |||
1859 | #ifdef USEQPE | 1860 | #ifdef USEQPE |
1860 | CBarPrefs* prefwin = new CBarPrefs(APPDIR, !m_bFloatingDialog, this); | 1861 | CBarPrefs* prefwin = new CBarPrefs(APPDIR, !m_bFloatingDialog, this); |
1861 | #else | 1862 | #else |
1862 | QFileInfo fi; | 1863 | QFileInfo fi; |
1863 | QDir d = QDir::home(); // "/" | 1864 | QDir d = QDir::home(); // "/" |
1864 | if ( !d.cd(APPDIR) ) | 1865 | if ( !d.cd(APPDIR) ) |
1865 | { // "/tmp" | 1866 | { // "/tmp" |
1866 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); | 1867 | owarn << "Cannot find the \"~/" << APPDIR << "\" directory" << oendl; |
1867 | d = QDir::home(); | 1868 | d = QDir::home(); |
1868 | d.mkdir(APPDIR); | 1869 | d.mkdir(APPDIR); |
1869 | d.cd(APPDIR); | 1870 | d.cd(APPDIR); |
1870 | } | 1871 | } |
1871 | fi.setFile(d, INIFILE); | 1872 | fi.setFile(d, INIFILE); |
1872 | CBarPrefs* prefwin = new CBarPrefs(fi.absFilePath(), !m_bFloatingDialog, this); | 1873 | CBarPrefs* prefwin = new CBarPrefs(fi.absFilePath(), !m_bFloatingDialog, this); |
1873 | #endif | 1874 | #endif |
1874 | prefwin->tbpolicy(m_tbpolsave); | 1875 | prefwin->tbpolicy(m_tbpolsave); |
@@ -1877,42 +1878,42 @@ void QTReaderApp::showtoolbarprefs() | |||
1877 | prefwin->floating(m_bFloatingDialog); | 1878 | prefwin->floating(m_bFloatingDialog); |
1878 | if (prefwin->exec()) | 1879 | if (prefwin->exec()) |
1879 | { | 1880 | { |
1880 | m_bFloatingDialog = prefwin->floating(); | 1881 | m_bFloatingDialog = prefwin->floating(); |
1881 | if ( | 1882 | if ( |
1882 | m_tbpolsave != (ToolbarPolicy)prefwin->tbpolicy() | 1883 | m_tbpolsave != (ToolbarPolicy)prefwin->tbpolicy() |
1883 | || | 1884 | || |
1884 | m_tbposition != (ToolBarDock)(prefwin->tbposition()+2) | 1885 | m_tbposition != (ToolBarDock)(prefwin->tbposition()+2) |
1885 | || | 1886 | || |
1886 | m_tbmovesave != prefwin->tbmovable() | 1887 | m_tbmovesave != prefwin->tbmovable() |
1887 | ) | 1888 | ) |
1888 | { | 1889 | { |
1889 | QMessageBox::warning(this, PROGNAME, "Some changes won't take effect\nuntil the next time the\napplication is started"); | 1890 | QMessageBox::warning(this, PROGNAME, "Some changes won't take effect\nuntil the next time the\napplication is started"); |
1890 | } | 1891 | } |
1891 | m_tbpolsave = (ToolbarPolicy)prefwin->tbpolicy(); | 1892 | m_tbpolsave = (ToolbarPolicy)prefwin->tbpolicy(); |
1892 | m_tbposition = (ToolBarDock)(prefwin->tbposition()+2); | 1893 | m_tbposition = (ToolBarDock)(prefwin->tbposition()+2); |
1893 | m_tbmovesave = prefwin->tbmovable(); | 1894 | m_tbmovesave = prefwin->tbmovable(); |
1894 | bool isChanged = prefwin->isChanged(); | 1895 | bool isChanged = prefwin->isChanged(); |
1895 | delete prefwin; | 1896 | delete prefwin; |
1896 | #ifdef USEQPE | 1897 | #ifdef USEQPE |
1897 | Config config( APPDIR ); | 1898 | Config config( APPDIR ); |
1898 | #else | 1899 | #else |
1899 | QFileInfo fi; | 1900 | QFileInfo fi; |
1900 | QDir d = QDir::home(); // "/" | 1901 | QDir d = QDir::home(); // "/" |
1901 | if ( !d.cd(APPDIR) ) | 1902 | if ( !d.cd(APPDIR) ) |
1902 | { // "/tmp" | 1903 | { // "/tmp" |
1903 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); | 1904 | owarn << "Cannot find the \"~/" << APPDIR << "\" directory" << oendl; |
1904 | d = QDir::home(); | 1905 | d = QDir::home(); |
1905 | d.mkdir(APPDIR); | 1906 | d.mkdir(APPDIR); |
1906 | d.cd(APPDIR); | 1907 | d.cd(APPDIR); |
1907 | } | 1908 | } |
1908 | fi.setFile(d, INIFILE); | 1909 | fi.setFile(d, INIFILE); |
1909 | Config config( fi.absFilePath() ); | 1910 | Config config( fi.absFilePath() ); |
1910 | #endif | 1911 | #endif |
1911 | if (isChanged) addtoolbars(&config); | 1912 | if (isChanged) addtoolbars(&config); |
1912 | } | 1913 | } |
1913 | else | 1914 | else |
1914 | { | 1915 | { |
1915 | delete prefwin; | 1916 | delete prefwin; |
1916 | } | 1917 | } |
1917 | } | 1918 | } |
1918 | 1919 | ||
@@ -1921,19 +1922,19 @@ void QTReaderApp::showinfo() | |||
1921 | unsigned long fs, ts, pl; | 1922 | unsigned long fs, ts, pl; |
1922 | if (reader->empty()) | 1923 | if (reader->empty()) |
1923 | { | 1924 | { |
1924 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); | 1925 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); |
1925 | } | 1926 | } |
1926 | else | 1927 | else |
1927 | { | 1928 | { |
1928 | reader->sizes(fs,ts); | 1929 | reader->sizes(fs,ts); |
1929 | pl = reader->pagelocate(); | 1930 | pl = reader->pagelocate(); |
1930 | m_infoWin->setFileSize(fs); | 1931 | m_infoWin->setFileSize(fs); |
1931 | m_infoWin->setTextSize(ts); | 1932 | m_infoWin->setTextSize(ts); |
1932 | m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); | 1933 | m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); |
1933 | m_infoWin->setLocation(pl); | 1934 | m_infoWin->setLocation(pl); |
1934 | m_infoWin->setRead((100*pl + (ts >> 1))/ts); | 1935 | m_infoWin->setRead((100*pl + (ts >> 1))/ts); |
1935 | editorStack->raiseWidget( m_infoWin ); | 1936 | editorStack->raiseWidget( m_infoWin ); |
1936 | m_infoWin->setFocus(); | 1937 | m_infoWin->setFocus(); |
1937 | } | 1938 | } |
1938 | } | 1939 | } |
1939 | 1940 | ||
@@ -1945,13 +1946,13 @@ void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn) | |||
1945 | int i; | 1946 | int i; |
1946 | for (i = 0; i < name.length(); i++) | 1947 | for (i = 0; i < name.length(); i++) |
1947 | { | 1948 | { |
1948 | buff[i] = name[i].unicode(); | 1949 | buff[i] = name[i].unicode(); |
1949 | } | 1950 | } |
1950 | buff[i] = 0; | 1951 | buff[i] = 0; |
1951 | CBuffer buff2(text.length()+1); | 1952 | CBuffer buff2(text.length()+1); |
1952 | for (i = 0; i < text.length(); i++) | 1953 | for (i = 0; i < text.length(); i++) |
1953 | { | 1954 | { |
1954 | buff2[i] = text[i].unicode(); | 1955 | buff2[i] = text[i].unicode(); |
1955 | } | 1956 | } |
1956 | buff2[i] = 0; | 1957 | buff2[i] = 0; |
1957 | pBkmklist->push_front(Bkmk(buff.data(), buff2.data(), posn)); | 1958 | pBkmklist->push_front(Bkmk(buff.data(), buff2.data(), posn)); |
@@ -1966,40 +1967,40 @@ void QTReaderApp::addAnno(const QString& name, const QString& text) | |||
1966 | { | 1967 | { |
1967 | if (m_annoIsEditing) | 1968 | if (m_annoIsEditing) |
1968 | { | 1969 | { |
1969 | if (name.isEmpty()) | 1970 | if (name.isEmpty()) |
1970 | { | 1971 | { |
1971 | QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nPlease try again", 1); | 1972 | QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nPlease try again", 1); |
1972 | } | 1973 | } |
1973 | else | 1974 | else |
1974 | { | 1975 | { |
1975 | addAnno(name, text, m_annoWin->getPosn()); | 1976 | addAnno(name, text, m_annoWin->getPosn()); |
1976 | } | 1977 | } |
1977 | showEditTools(); | 1978 | showEditTools(); |
1979 | } | ||
1980 | else | ||
1981 | { | ||
1982 | if (m_annoWin->edited()) | ||
1983 | { | ||
1984 | CBuffer buff(text.length()+1); | ||
1985 | int i; | ||
1986 | for (i = 0; i < text.length(); i++) | ||
1987 | { | ||
1988 | buff[i] = text[i].unicode(); | ||
1989 | } | ||
1990 | buff[i] = 0; | ||
1991 | m_fBkmksChanged = true; | ||
1992 | m_anno->setAnno(buff.data()); | ||
1993 | } | ||
1994 | bool found = findNextBookmark(m_anno->value()+1); | ||
1995 | if (found) | ||
1996 | { | ||
1997 | m_annoWin->setName(toQString(m_anno->name())); | ||
1998 | m_annoWin->setAnno(toQString(m_anno->anno())); | ||
1978 | } | 1999 | } |
1979 | else | 2000 | else |
1980 | { | 2001 | { |
1981 | if (m_annoWin->edited()) | 2002 | showEditTools(); |
1982 | { | 2003 | } |
1983 | CBuffer buff(text.length()+1); | ||
1984 | int i; | ||
1985 | for (i = 0; i < text.length(); i++) | ||
1986 | { | ||
1987 | buff[i] = text[i].unicode(); | ||
1988 | } | ||
1989 | buff[i] = 0; | ||
1990 | m_fBkmksChanged = true; | ||
1991 | m_anno->setAnno(buff.data()); | ||
1992 | } | ||
1993 | bool found = findNextBookmark(m_anno->value()+1); | ||
1994 | if (found) | ||
1995 | { | ||
1996 | m_annoWin->setName(toQString(m_anno->name())); | ||
1997 | m_annoWin->setAnno(toQString(m_anno->anno())); | ||
1998 | } | ||
1999 | else | ||
2000 | { | ||
2001 | showEditTools(); | ||
2002 | } | ||
2003 | } | 2004 | } |
2004 | } | 2005 | } |
2005 | 2006 | ||
@@ -2008,15 +2009,15 @@ bool QTReaderApp::findNextBookmark(size_t start) | |||
2008 | bool found = false; | 2009 | bool found = false; |
2009 | for (CList<Bkmk>::iterator iter = pBkmklist->begin(); iter != pBkmklist->end(); iter++) | 2010 | for (CList<Bkmk>::iterator iter = pBkmklist->begin(); iter != pBkmklist->end(); iter++) |
2010 | { | 2011 | { |
2011 | if (iter->value() >= start) | 2012 | if (iter->value() >= start) |
2012 | { | 2013 | { |
2013 | if (iter->value() < reader->locate()) | 2014 | if (iter->value() < reader->locate()) |
2014 | { | 2015 | { |
2015 | found = true; | 2016 | found = true; |
2016 | m_anno = iter.pContent(); | 2017 | m_anno = iter.pContent(); |
2017 | } | 2018 | } |
2018 | break; | 2019 | break; |
2019 | } | 2020 | } |
2020 | } | 2021 | } |
2021 | return found; | 2022 | return found; |
2022 | } | 2023 | } |
@@ -2025,19 +2026,19 @@ void QTReaderApp::addanno() | |||
2025 | { | 2026 | { |
2026 | if (reader->empty()) | 2027 | if (reader->empty()) |
2027 | { | 2028 | { |
2028 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); | 2029 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); |
2029 | } | 2030 | } |
2030 | else | 2031 | else |
2031 | { | 2032 | { |
2032 | m_annoWin->setName(""); | 2033 | m_annoWin->setName(""); |
2033 | m_annoWin->setAnno(""); | 2034 | m_annoWin->setAnno(""); |
2034 | m_annoWin->setPosn(reader->pagelocate()); | 2035 | m_annoWin->setPosn(reader->pagelocate()); |
2035 | m_annoIsEditing = true; | 2036 | m_annoIsEditing = true; |
2036 | editorStack->raiseWidget( m_annoWin ); | 2037 | editorStack->raiseWidget( m_annoWin ); |
2037 | #ifdef USEQPE | 2038 | #ifdef USEQPE |
2038 | Global::showInputMethod(); | 2039 | Global::showInputMethod(); |
2039 | #endif | 2040 | #endif |
2040 | m_annoWin->setFocus(); | 2041 | m_annoWin->setFocus(); |
2041 | } | 2042 | } |
2042 | } | 2043 | } |
2043 | 2044 | ||
@@ -2067,23 +2068,23 @@ void QTReaderApp::editMark() | |||
2067 | 2068 | ||
2068 | void QTReaderApp::editCopy() | 2069 | void QTReaderApp::editCopy() |
2069 | { | 2070 | { |
2070 | QClipboard* cb = QApplication::clipboard(); | 2071 | QClipboard* cb = QApplication::clipboard(); |
2071 | QString text; | 2072 | QString text; |
2072 | int ch; | 2073 | int ch; |
2073 | unsigned long currentpos = reader->pagelocate(); | 2074 | unsigned long currentpos = reader->pagelocate(); |
2074 | unsigned long endpos = reader->locate(); | 2075 | unsigned long endpos = reader->locate(); |
2075 | if (m_savedpos == 0xffffffff) | 2076 | if (m_savedpos == 0xffffffff) |
2076 | { | 2077 | { |
2077 | m_savedpos = currentpos; | 2078 | m_savedpos = currentpos; |
2078 | } | 2079 | } |
2079 | reader->jumpto(m_savedpos); | 2080 | reader->jumpto(m_savedpos); |
2080 | while (reader->explocate() < endpos && (ch = reader->getch()) != UEOF) | 2081 | while (reader->explocate() < endpos && (ch = reader->getch()) != UEOF) |
2081 | { | 2082 | { |
2082 | text += ch; | 2083 | text += ch; |
2083 | } | 2084 | } |
2084 | cb->setText(text); | 2085 | cb->setText(text); |
2085 | reader->locate(currentpos); | 2086 | reader->locate(currentpos); |
2086 | m_savedpos = 0xffffffff; | 2087 | m_savedpos = 0xffffffff; |
2087 | } | 2088 | } |
2088 | 2089 | ||
2089 | void QTReaderApp::gotoStart() | 2090 | void QTReaderApp::gotoStart() |
@@ -2125,8 +2126,8 @@ void QTReaderApp::settarget() | |||
2125 | { | 2126 | { |
2126 | m_nRegAction = cSetTarget; | 2127 | m_nRegAction = cSetTarget; |
2127 | QString text = ((m_targetapp.isEmpty()) ? QString("") : m_targetapp) | 2128 | QString text = ((m_targetapp.isEmpty()) ? QString("") : m_targetapp) |
2128 | + "/" | 2129 | + "/" |
2129 | + ((m_targetmsg.isEmpty()) ? QString("") : m_targetmsg); | 2130 | + ((m_targetmsg.isEmpty()) ? QString("") : m_targetmsg); |
2130 | regEdit->setText(text); | 2131 | regEdit->setText(text); |
2131 | do_regedit(); | 2132 | do_regedit(); |
2132 | } | 2133 | } |
@@ -2138,13 +2139,13 @@ void QTReaderApp::do_mono(const QString& lcn) | |||
2138 | unsigned long ulcn = lcn.toULong(&ok); | 2139 | unsigned long ulcn = lcn.toULong(&ok); |
2139 | if (ok) | 2140 | if (ok) |
2140 | { | 2141 | { |
2141 | reader->m_charpc = ulcn; | 2142 | reader->m_charpc = ulcn; |
2142 | reader->setfont(); | 2143 | reader->setfont(); |
2143 | reader->refresh(); | 2144 | reader->refresh(); |
2144 | //reader->setmono(true); | 2145 | // reader->setmono(true); |
2145 | } | 2146 | } |
2146 | else | 2147 | else |
2147 | QMessageBox::information(this, PROGNAME, "Must be a number"); | 2148 | QMessageBox::information(this, PROGNAME, "Must be a number"); |
2148 | } | 2149 | } |
2149 | */ | 2150 | */ |
2150 | /* | 2151 | /* |
@@ -2175,7 +2176,7 @@ void QTReaderApp::editFind() | |||
2175 | 2176 | ||
2176 | void QTReaderApp::findNext() | 2177 | void QTReaderApp::findNext() |
2177 | { | 2178 | { |
2178 | // // qDebug("findNext called\n"); | 2179 | // // odebug << "findNext called\n" << oendl; |
2179 | #ifdef __ISEARCH | 2180 | #ifdef __ISEARCH |
2180 | QString arg = searchEdit->text(); | 2181 | QString arg = searchEdit->text(); |
2181 | #else | 2182 | #else |
@@ -2249,44 +2250,44 @@ bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg) | |||
2249 | #endif | 2250 | #endif |
2250 | #endif | 2251 | #endif |
2251 | { | 2252 | { |
2252 | pos = reader->locate(); | 2253 | pos = reader->locate(); |
2253 | int pc = (100*pos)/ts; | 2254 | int pc = (100*pos)/ts; |
2254 | if (pc != lastpc) | 2255 | if (pc != lastpc) |
2255 | { | 2256 | { |
2256 | pbar->setProgress(pc); | 2257 | pbar->setProgress(pc); |
2257 | qApp->processEvents(); | 2258 | qApp->processEvents(); |
2258 | reader->setFocus(); | 2259 | reader->setFocus(); |
2259 | lastpc = pc; | 2260 | lastpc = pc; |
2260 | } | ||
2261 | |||
2262 | if (reader->buffdoc.getpara(test) < 0) | ||
2263 | { | ||
2264 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) | ||
2265 | pos = searchStart; | ||
2266 | else | ||
2267 | pos = start; | ||
2268 | findClose(); | ||
2269 | pbar->hide(); | ||
2270 | reader->locate(pos); | ||
2271 | return false; | ||
2272 | } | ||
2273 | } | 2261 | } |
2274 | // qDebug("Found it at %u:%u", pos, offset); | 2262 | |
2263 | if (reader->buffdoc.getpara(test) < 0) | ||
2264 | { | ||
2265 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) | ||
2266 | pos = searchStart; | ||
2267 | else | ||
2268 | pos = start; | ||
2269 | findClose(); | ||
2270 | pbar->hide(); | ||
2271 | reader->locate(pos); | ||
2272 | return false; | ||
2273 | } | ||
2274 | } | ||
2275 | // odebug << "Found it at " << pos << ":" << offset << "" << oendl; | ||
2275 | pbar->hide(); | 2276 | pbar->hide(); |
2276 | // qDebug("Hid"); | 2277 | // odebug << "Hid" << oendl; |
2277 | reader->locate(pos+offset); | 2278 | reader->locate(pos+offset); |
2278 | // qDebug("Loacted"); | 2279 | // odebug << "Loacted" << oendl; |
2279 | // qDebug("page up"); | 2280 | // odebug << "page up" << oendl; |
2280 | ret = true; | 2281 | ret = true; |
2281 | } | 2282 | } |
2282 | else | 2283 | else |
2283 | { | 2284 | { |
2284 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) | 2285 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) |
2285 | pos = searchStart; | 2286 | pos = searchStart; |
2286 | else | 2287 | else |
2287 | pos = start; | 2288 | pos = start; |
2288 | ret = false; | 2289 | ret = false; |
2289 | findClose(); | 2290 | findClose(); |
2290 | } | 2291 | } |
2291 | return ret; | 2292 | return ret; |
2292 | } | 2293 | } |
@@ -2333,7 +2334,7 @@ void QTReaderApp::search() | |||
2333 | 2334 | ||
2334 | void QTReaderApp::openFile( const QString &f ) | 2335 | void QTReaderApp::openFile( const QString &f ) |
2335 | { | 2336 | { |
2336 | // qDebug("File:%s", (const char*)f); | 2337 | // odebug << "File:" << f << "" << oendl; |
2337 | // openFile(DocLnk(f)); | 2338 | // openFile(DocLnk(f)); |
2338 | //} | 2339 | //} |
2339 | // | 2340 | // |
@@ -2345,13 +2346,13 @@ void QTReaderApp::openFile( const QString &f ) | |||
2345 | { | 2346 | { |
2346 | // QMessageBox::information(0, "Progress", "Calling fileNew()"); | 2347 | // QMessageBox::information(0, "Progress", "Calling fileNew()"); |
2347 | #ifdef USEQPE | 2348 | #ifdef USEQPE |
2348 | if (fm.extension( FALSE ) == "desktop") | 2349 | if (fm.extension( FALSE ) == "desktop") |
2349 | { | 2350 | { |
2350 | DocLnk d(f); | 2351 | DocLnk d(f); |
2351 | QFileInfo fnew(d.file()); | 2352 | QFileInfo fnew(d.file()); |
2352 | fm = fnew; | 2353 | fm = fnew; |
2353 | if (!fm.exists()) return; | 2354 | if (!fm.exists()) return; |
2354 | } | 2355 | } |
2355 | #endif | 2356 | #endif |
2356 | clear(); | 2357 | clear(); |
2357 | 2358 | ||
@@ -2366,120 +2367,120 @@ void QTReaderApp::openFile( const QString &f ) | |||
2366 | QMessageBox::information(this, PROGNAME, "File does not exist"); | 2367 | QMessageBox::information(this, PROGNAME, "File does not exist"); |
2367 | reader->m_lastfile = QString::null; | 2368 | reader->m_lastfile = QString::null; |
2368 | } | 2369 | } |
2369 | 2370 | ||
2370 | } | 2371 | } |
2371 | /* | 2372 | /* |
2372 | void QTReaderApp::resizeEvent(QResizeEvent* e) | 2373 | void QTReaderApp::resizeEvent(QResizeEvent* e) |
2373 | { | 2374 | { |
2374 | if (m_fullscreen) | 2375 | if (m_fullscreen) |
2375 | { | 2376 | { |
2376 | showNormal(); | 2377 | showNormal(); |
2377 | showFullScreen(); | 2378 | showFullScreen(); |
2378 | } | 2379 | } |
2379 | } | 2380 | } |
2380 | */ | 2381 | */ |
2381 | void QTReaderApp::handlekey(QKeyEvent* e) | 2382 | void QTReaderApp::handlekey(QKeyEvent* e) |
2382 | { | 2383 | { |
2383 | // qDebug("Keypress event"); | 2384 | // odebug << "Keypress event" << oendl; |
2384 | timeb now; | 2385 | timeb now; |
2385 | ftime(&now); | 2386 | ftime(&now); |
2386 | unsigned long etime = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm; | 2387 | unsigned long etime = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm; |
2387 | if (etime < m_debounce) | 2388 | if (etime < m_debounce) |
2388 | { | 2389 | { |
2389 | return; | 2390 | return; |
2390 | } | 2391 | } |
2391 | m_lastkeytime = now; | 2392 | m_lastkeytime = now; |
2392 | switch(e->key()) | 2393 | switch(e->key()) |
2393 | { | 2394 | { |
2394 | case Key_Escape: | 2395 | case Key_Escape: |
2395 | // qDebug("escape event"); | 2396 | // odebug << "escape event" << oendl; |
2396 | if (m_disableesckey) | 2397 | if (m_disableesckey) |
2397 | { | 2398 | { |
2398 | m_disableesckey = false; | 2399 | m_disableesckey = false; |
2399 | } | 2400 | } |
2400 | else | 2401 | else |
2401 | { | 2402 | { |
2402 | m_bcloseDisabled = true; | 2403 | m_bcloseDisabled = true; |
2403 | if (m_fullscreen) | 2404 | if (m_fullscreen) |
2404 | { | 2405 | { |
2405 | m_actFullscreen->setOn(false); | 2406 | m_actFullscreen->setOn(false); |
2406 | e->accept(); | 2407 | e->accept(); |
2407 | } | 2408 | } |
2408 | else | 2409 | else |
2409 | { | 2410 | { |
2410 | // qDebug("escape action"); | 2411 | // odebug << "escape action" << oendl; |
2411 | doAction(m_escapeTarget, e); | 2412 | doAction(m_escapeTarget, e); |
2412 | } | 2413 | } |
2413 | } | 2414 | } |
2414 | break; | 2415 | break; |
2415 | case Key_Space: | 2416 | case Key_Space: |
2416 | { | 2417 | { |
2417 | doAction(m_spaceTarget, e); | 2418 | doAction(m_spaceTarget, e); |
2418 | } | 2419 | } |
2419 | break; | 2420 | break; |
2420 | case Key_Return: | 2421 | case Key_Return: |
2421 | { | 2422 | { |
2422 | doAction(m_returnTarget, e); | 2423 | doAction(m_returnTarget, e); |
2423 | } | 2424 | } |
2424 | break; | 2425 | break; |
2425 | case Key_Left: | 2426 | case Key_Left: |
2426 | { | 2427 | { |
2427 | if (reader->m_autoScroll && m_leftScroll) | 2428 | if (reader->m_autoScroll && m_leftScroll) |
2428 | { | 2429 | { |
2429 | reader->reduceScroll(); | 2430 | reader->reduceScroll(); |
2430 | } | 2431 | } |
2431 | else | 2432 | else |
2432 | { | 2433 | { |
2433 | doAction(m_leftTarget, e); | 2434 | doAction(m_leftTarget, e); |
2434 | } | 2435 | } |
2435 | } | 2436 | } |
2436 | break; | 2437 | break; |
2437 | case Key_Right: | 2438 | case Key_Right: |
2438 | { | 2439 | { |
2439 | if (reader->m_autoScroll && m_rightScroll) | 2440 | if (reader->m_autoScroll && m_rightScroll) |
2440 | { | 2441 | { |
2441 | reader->increaseScroll(); | 2442 | reader->increaseScroll(); |
2442 | } | 2443 | } |
2443 | else | 2444 | else |
2444 | { | 2445 | { |
2445 | doAction(m_rightTarget, e); | 2446 | doAction(m_rightTarget, e); |
2446 | } | 2447 | } |
2447 | } | 2448 | } |
2448 | break; | 2449 | break; |
2449 | case Key_Up: | 2450 | case Key_Up: |
2450 | { | 2451 | { |
2451 | if (reader->m_autoScroll && m_upScroll) | 2452 | if (reader->m_autoScroll && m_upScroll) |
2452 | { | 2453 | { |
2453 | reader->increaseScroll(); | 2454 | reader->increaseScroll(); |
2454 | } | 2455 | } |
2455 | else | 2456 | else |
2456 | { | 2457 | { |
2457 | doAction(m_upTarget, e); | 2458 | doAction(m_upTarget, e); |
2458 | } | 2459 | } |
2459 | } | 2460 | } |
2460 | break; | 2461 | break; |
2461 | case Key_Down: | 2462 | case Key_Down: |
2462 | { | 2463 | { |
2463 | if (reader->m_autoScroll && m_downScroll) | 2464 | if (reader->m_autoScroll && m_downScroll) |
2464 | { | 2465 | { |
2465 | reader->reduceScroll(); | 2466 | reader->reduceScroll(); |
2466 | } | 2467 | } |
2467 | else | 2468 | else |
2468 | { | 2469 | { |
2469 | doAction(m_downTarget, e); | 2470 | doAction(m_downTarget, e); |
2470 | } | 2471 | } |
2471 | } | 2472 | } |
2472 | break; | 2473 | break; |
2473 | default: | 2474 | default: |
2474 | { | 2475 | { |
2475 | e->ignore(); | 2476 | e->ignore(); |
2476 | } | 2477 | } |
2477 | 2478 | ||
2478 | /* | 2479 | /* |
2479 | QString msg("Key press was:"); | 2480 | QString msg("Key press was:"); |
2480 | QString key; | 2481 | QString key; |
2481 | msg += key.setNum(e->key()); | 2482 | msg += key.setNum(e->key()); |
2482 | QMessageBox::information(this, PROGNAME, msg); | 2483 | QMessageBox::information(this, PROGNAME, msg); |
2483 | */ | 2484 | */ |
2484 | } | 2485 | } |
2485 | } | 2486 | } |
@@ -2487,65 +2488,65 @@ void QTReaderApp::handlekey(QKeyEvent* e) | |||
2487 | void QTReaderApp::showEditTools() | 2488 | void QTReaderApp::showEditTools() |
2488 | { | 2489 | { |
2489 | // if ( !doc ) | 2490 | // if ( !doc ) |
2490 | //close(); | 2491 | // close(); |
2491 | if (m_fullscreen) | 2492 | if (m_fullscreen) |
2492 | { | 2493 | { |
2493 | if (menubar != NULL) menubar->hide(); | 2494 | if (menubar != NULL) menubar->hide(); |
2494 | if (fileBar != NULL) fileBar->hide(); | 2495 | if (fileBar != NULL) fileBar->hide(); |
2495 | if (viewBar != NULL) viewBar->hide(); | 2496 | if (viewBar != NULL) viewBar->hide(); |
2496 | if (navBar != NULL) navBar->hide(); | 2497 | if (navBar != NULL) navBar->hide(); |
2497 | if (markBar != NULL) markBar->hide(); | 2498 | if (markBar != NULL) markBar->hide(); |
2498 | searchBar->hide(); | 2499 | searchBar->hide(); |
2499 | regBar->hide(); | 2500 | regBar->hide(); |
2500 | #ifdef USEQPE | 2501 | #ifdef USEQPE |
2501 | Global::hideInputMethod(); | 2502 | Global::hideInputMethod(); |
2502 | #endif | 2503 | #endif |
2503 | m_fontBar->hide(); | 2504 | m_fontBar->hide(); |
2504 | //showNormal(); | 2505 | // showNormal(); |
2505 | showFullScreen(); | 2506 | showFullScreen(); |
2506 | } | 2507 | } |
2507 | else | 2508 | else |
2508 | { | 2509 | { |
2509 | //qDebug("him"); | 2510 | // odebug << "him" << oendl; |
2510 | #ifdef USEQPE | 2511 | #ifdef USEQPE |
2511 | Global::hideInputMethod(); | 2512 | Global::hideInputMethod(); |
2512 | #endif | 2513 | #endif |
2513 | //qDebug("eb"); | 2514 | // odebug << "eb" << oendl; |
2514 | menubar->show(); | 2515 | menubar->show(); |
2515 | if (fileBar != NULL) fileBar->show(); | 2516 | if (fileBar != NULL) fileBar->show(); |
2516 | if (viewBar != NULL) viewBar->show(); | 2517 | if (viewBar != NULL) viewBar->show(); |
2517 | if (navBar != NULL) navBar->show(); | 2518 | if (navBar != NULL) navBar->show(); |
2518 | if (markBar != NULL) markBar->show(); | 2519 | if (markBar != NULL) markBar->show(); |
2519 | mb->show(); | 2520 | mb->show(); |
2520 | if ( searchVisible ) | 2521 | if ( searchVisible ) |
2521 | { | 2522 | { |
2522 | #ifdef USEQPE | 2523 | #ifdef USEQPE |
2523 | Global::showInputMethod(); | 2524 | Global::showInputMethod(); |
2524 | #endif | 2525 | #endif |
2525 | searchBar->show(); | 2526 | searchBar->show(); |
2526 | } | 2527 | } |
2527 | if ( regVisible ) | 2528 | if ( regVisible ) |
2528 | { | 2529 | { |
2529 | #ifdef USEQPE | 2530 | #ifdef USEQPE |
2530 | Global::showInputMethod(); | 2531 | Global::showInputMethod(); |
2531 | #endif | 2532 | #endif |
2532 | regBar->show(); | 2533 | regBar->show(); |
2533 | } | 2534 | } |
2534 | if (m_fontVisible) m_fontBar->show(); | 2535 | if (m_fontVisible) m_fontBar->show(); |
2535 | //qDebug("sn"); | 2536 | // odebug << "sn" << oendl; |
2536 | showNormal(); | 2537 | showNormal(); |
2537 | //qDebug("sm"); | 2538 | // odebug << "sm" << oendl; |
2538 | #ifdef USEQPE | 2539 | #ifdef USEQPE |
2539 | showMaximized(); | 2540 | showMaximized(); |
2540 | #endif | 2541 | #endif |
2541 | //setCentralWidget(reader); | 2542 | // setCentralWidget(reader); |
2542 | } | 2543 | } |
2543 | 2544 | ||
2544 | // qDebug("uc"); | 2545 | // odebug << "uc" << oendl; |
2545 | updateCaption(); | 2546 | updateCaption(); |
2546 | // qDebug("rw"); | 2547 | // odebug << "rw" << oendl; |
2547 | editorStack->raiseWidget( reader ); | 2548 | editorStack->raiseWidget( reader ); |
2548 | // qDebug("sf"); | 2549 | // odebug << "sf" << oendl; |
2549 | reader->setFocus(); | 2550 | reader->setFocus(); |
2550 | reader->refresh(); | 2551 | reader->refresh(); |
2551 | } | 2552 | } |
@@ -2553,27 +2554,27 @@ void QTReaderApp::showEditTools() | |||
2553 | void QTReaderApp::save() | 2554 | void QTReaderApp::save() |
2554 | { | 2555 | { |
2555 | if ( !doc ) | 2556 | if ( !doc ) |
2556 | return; | 2557 | return; |
2557 | if ( !editor->edited() ) | 2558 | if ( !editor->edited() ) |
2558 | return; | 2559 | return; |
2559 | 2560 | ||
2560 | QString rt = editor->text(); | 2561 | QString rt = editor->text(); |
2561 | QString pt = rt; | 2562 | QString pt = rt; |
2562 | 2563 | ||
2563 | if ( doc->name().isEmpty() ) { | 2564 | if ( doc->name().isEmpty() ) { |
2564 | unsigned ispace = pt.find( ' ' ); | 2565 | unsigned ispace = pt.find( ' ' ); |
2565 | unsigned ienter = pt.find( '\n' ); | 2566 | unsigned ienter = pt.find( '\n' ); |
2566 | int i = (ispace < ienter) ? ispace : ienter; | 2567 | int i = (ispace < ienter) ? ispace : ienter; |
2567 | QString docname; | 2568 | QString docname; |
2568 | if ( i == -1 ) { | 2569 | if ( i == -1 ) { |
2569 | if ( pt.isEmpty() ) | 2570 | if ( pt.isEmpty() ) |
2570 | docname = "Empty Text"; | 2571 | docname = "Empty Text"; |
2571 | else | 2572 | else |
2572 | docname = pt; | 2573 | docname = pt; |
2573 | } else { | 2574 | } else { |
2574 | docname = pt.left( i ); | 2575 | docname = pt.left( i ); |
2575 | } | 2576 | } |
2576 | doc->setName(docname); | 2577 | doc->setName(docname); |
2577 | } | 2578 | } |
2578 | FileManager fm; | 2579 | FileManager fm; |
2579 | fm.saveFile( *doc, rt ); | 2580 | fm.saveFile( *doc, rt ); |
@@ -2585,9 +2586,9 @@ void QTReaderApp::clear() | |||
2585 | // if (doc != 0) | 2586 | // if (doc != 0) |
2586 | // { | 2587 | // { |
2587 | // QMessageBox::information(this, PROGNAME, "Deleting doc", 1); | 2588 | // QMessageBox::information(this, PROGNAME, "Deleting doc", 1); |
2588 | //delete doc; | 2589 | // delete doc; |
2589 | // QMessageBox::information(this, PROGNAME, "Deleted doc", 1); | 2590 | // QMessageBox::information(this, PROGNAME, "Deleted doc", 1); |
2590 | //doc = 0; | 2591 | // doc = 0; |
2591 | // } | 2592 | // } |
2592 | reader->clear(); | 2593 | reader->clear(); |
2593 | } | 2594 | } |
@@ -2595,12 +2596,12 @@ void QTReaderApp::clear() | |||
2595 | void QTReaderApp::updateCaption() | 2596 | void QTReaderApp::updateCaption() |
2596 | { | 2597 | { |
2597 | // if ( !doc ) | 2598 | // if ( !doc ) |
2598 | //setCaption( tr("QTReader") ); | 2599 | // setCaption( tr("QTReader") ); |
2599 | // else { | 2600 | // else { |
2600 | //QString s = doc->name(); | 2601 | // QString s = doc->name(); |
2601 | //if ( s.isEmpty() ) | 2602 | // if ( s.isEmpty() ) |
2602 | // s = tr( "Unnamed" ); | 2603 | // s = tr( "Unnamed" ); |
2603 | setCaption( reader->m_string + " - " + tr("Reader") ); | 2604 | setCaption( reader->m_string + " - " + tr("Reader") ); |
2604 | // } | 2605 | // } |
2605 | } | 2606 | } |
2606 | 2607 | ||
@@ -2614,71 +2615,71 @@ void QTReaderApp::setDocument(const QString& fileref) | |||
2614 | 2615 | ||
2615 | void QTReaderApp::closeEvent( QCloseEvent *e ) | 2616 | void QTReaderApp::closeEvent( QCloseEvent *e ) |
2616 | { | 2617 | { |
2617 | // qDebug("Close event"); | 2618 | // odebug << "Close event" << oendl; |
2618 | if (m_fullscreen) | 2619 | if (m_fullscreen) |
2619 | { | 2620 | { |
2620 | m_fullscreen = false; | 2621 | m_fullscreen = false; |
2621 | showEditTools(); | 2622 | showEditTools(); |
2622 | e->accept(); | 2623 | e->accept(); |
2623 | } | 2624 | } |
2624 | else if (m_dontSave) | 2625 | else if (m_dontSave) |
2625 | { | 2626 | { |
2626 | e->accept(); | 2627 | e->accept(); |
2627 | } | 2628 | } |
2628 | else | 2629 | else |
2629 | { | 2630 | { |
2630 | if (editorStack->visibleWidget() == reader) | 2631 | if (editorStack->visibleWidget() == reader) |
2631 | { | 2632 | { |
2632 | if ((m_escapeTarget != cesNone) && m_bcloseDisabled) | 2633 | if ((m_escapeTarget != cesNone) && m_bcloseDisabled) |
2633 | { | 2634 | { |
2634 | //qDebug("Close disabled"); | 2635 | // odebug << "Close disabled" << oendl; |
2635 | m_bcloseDisabled = false; | 2636 | m_bcloseDisabled = false; |
2636 | e->ignore(); | 2637 | e->ignore(); |
2637 | } | 2638 | } |
2638 | else | 2639 | else |
2639 | { | 2640 | { |
2640 | if (m_fontVisible) | 2641 | if (m_fontVisible) |
2641 | { | 2642 | { |
2642 | m_fontBar->hide(); | 2643 | m_fontBar->hide(); |
2643 | m_fontVisible = false; | 2644 | m_fontVisible = false; |
2644 | } | 2645 | } |
2645 | if (regVisible) | 2646 | if (regVisible) |
2646 | { | 2647 | { |
2647 | regBar->hide(); | 2648 | regBar->hide(); |
2648 | #ifdef USEQPE | 2649 | #ifdef USEQPE |
2649 | Global::hideInputMethod(); | 2650 | Global::hideInputMethod(); |
2650 | #endif | 2651 | #endif |
2651 | regVisible = false; | 2652 | regVisible = false; |
2652 | return; | 2653 | return; |
2653 | } | 2654 | } |
2654 | if (searchVisible) | 2655 | if (searchVisible) |
2655 | { | 2656 | { |
2656 | searchBar->hide(); | 2657 | searchBar->hide(); |
2657 | #ifdef USEQPE | 2658 | #ifdef USEQPE |
2658 | Global::hideInputMethod(); | 2659 | Global::hideInputMethod(); |
2659 | #endif | 2660 | #endif |
2660 | searchVisible = false; | 2661 | searchVisible = false; |
2661 | return; | 2662 | return; |
2662 | } | 2663 | } |
2663 | if (m_fBkmksChanged && pBkmklist != NULL) | 2664 | if (m_fBkmksChanged && pBkmklist != NULL) |
2664 | { | 2665 | { |
2665 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) | 2666 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) |
2666 | savebkmks(); | 2667 | savebkmks(); |
2667 | delete pBkmklist; | 2668 | delete pBkmklist; |
2668 | pBkmklist = NULL; | 2669 | pBkmklist = NULL; |
2669 | m_fBkmksChanged = false; | 2670 | m_fBkmksChanged = false; |
2670 | } | 2671 | } |
2671 | bFromDocView = FALSE; | 2672 | bFromDocView = FALSE; |
2672 | updatefileinfo(); | 2673 | updatefileinfo(); |
2673 | saveprefs(); | 2674 | saveprefs(); |
2674 | e->accept(); | 2675 | e->accept(); |
2675 | } | 2676 | } |
2676 | } | 2677 | } |
2677 | else | 2678 | else |
2678 | { | 2679 | { |
2679 | showEditTools(); | 2680 | showEditTools(); |
2680 | m_disableesckey = true; | 2681 | m_disableesckey = true; |
2681 | } | 2682 | } |
2682 | } | 2683 | } |
2683 | } | 2684 | } |
2684 | 2685 | ||
@@ -2686,45 +2687,45 @@ void QTReaderApp::do_gotomark() | |||
2686 | { | 2687 | { |
2687 | m_nBkmkAction = cGotoBkmk; | 2688 | m_nBkmkAction = cGotoBkmk; |
2688 | if (!listbkmk(pBkmklist)) | 2689 | if (!listbkmk(pBkmklist)) |
2689 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); | 2690 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); |
2690 | } | 2691 | } |
2691 | 2692 | ||
2692 | void QTReaderApp::do_delmark() | 2693 | void QTReaderApp::do_delmark() |
2693 | { | 2694 | { |
2694 | m_nBkmkAction = cDelBkmk; | 2695 | m_nBkmkAction = cDelBkmk; |
2695 | if (!listbkmk(pBkmklist)) | 2696 | if (!listbkmk(pBkmklist)) |
2696 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); | 2697 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); |
2697 | } | 2698 | } |
2698 | 2699 | ||
2699 | bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab) | 2700 | bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab) |
2700 | { | 2701 | { |
2701 | bkmkselector->clear(); | 2702 | bkmkselector->clear(); |
2702 | if (_lab.isEmpty()) | 2703 | if (_lab.isEmpty()) |
2703 | bkmkselector->setText("Cancel"); | 2704 | bkmkselector->setText("Cancel"); |
2704 | else | 2705 | else |
2705 | bkmkselector->setText(_lab); | 2706 | bkmkselector->setText(_lab); |
2706 | int cnt = 0; | 2707 | int cnt = 0; |
2707 | if (plist != NULL) | 2708 | if (plist != NULL) |
2708 | { | 2709 | { |
2709 | for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++) | 2710 | for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++) |
2710 | { | 2711 | { |
2711 | #ifdef _UNICODE | 2712 | #ifdef _UNICODE |
2712 | // qDebug("Item:%s", (const char*)toQString(i->name())); | 2713 | // odebug << "Item:" << toQString(i->name()) << "" << oendl; |
2713 | bkmkselector->insertItem(toQString(i->name())); | 2714 | bkmkselector->insertItem(toQString(i->name())); |
2714 | #else | 2715 | #else |
2715 | bkmkselector->insertItem(i->name()); | 2716 | bkmkselector->insertItem(i->name()); |
2716 | #endif | 2717 | #endif |
2717 | cnt++; | 2718 | cnt++; |
2718 | } | 2719 | } |
2719 | } | 2720 | } |
2720 | if (cnt > 0) | 2721 | if (cnt > 0) |
2721 | { | 2722 | { |
2722 | hidetoolbars(); | 2723 | hidetoolbars(); |
2723 | editorStack->raiseWidget( bkmkselector ); | 2724 | editorStack->raiseWidget( bkmkselector ); |
2724 | return true; | 2725 | return true; |
2725 | } | 2726 | } |
2726 | else | 2727 | else |
2727 | return false; | 2728 | return false; |
2728 | } | 2729 | } |
2729 | 2730 | ||
2730 | void QTReaderApp::do_autogen() | 2731 | void QTReaderApp::do_autogen() |
@@ -2738,9 +2739,9 @@ void QTReaderApp::do_regedit() | |||
2738 | { | 2739 | { |
2739 | // fileBar->hide(); | 2740 | // fileBar->hide(); |
2740 | reader->bDoUpdates = false; | 2741 | reader->bDoUpdates = false; |
2741 | // qDebug("Showing regbar"); | 2742 | // odebug << "Showing regbar" << oendl; |
2742 | regBar->show(); | 2743 | regBar->show(); |
2743 | // qDebug("Showing kbd"); | 2744 | // odebug << "Showing kbd" << oendl; |
2744 | #ifdef USEQPE | 2745 | #ifdef USEQPE |
2745 | Global::showInputMethod(); | 2746 | Global::showInputMethod(); |
2746 | #endif | 2747 | #endif |
@@ -2754,42 +2755,42 @@ void QTReaderApp::do_regedit() | |||
2754 | bool QTReaderApp::openfrombkmk(Bkmk* bk) | 2755 | bool QTReaderApp::openfrombkmk(Bkmk* bk) |
2755 | { | 2756 | { |
2756 | QString fn = toQString( | 2757 | QString fn = toQString( |
2757 | CFiledata(bk->anno()).name() | 2758 | CFiledata(bk->anno()).name() |
2758 | ); | 2759 | ); |
2759 | //qDebug("fileinfo"); | 2760 | // odebug << "fileinfo" << oendl; |
2760 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) | 2761 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) |
2761 | { | 2762 | { |
2762 | //qDebug("Opening"); | 2763 | // odebug << "Opening" << oendl; |
2763 | openFile(fn); | 2764 | openFile(fn); |
2764 | struct stat fnstat; | 2765 | struct stat fnstat; |
2765 | stat((const char *)reader->m_lastfile, &fnstat); | 2766 | stat((const char *)reader->m_lastfile, &fnstat); |
2766 | 2767 | ||
2767 | if (CFiledata(bk->anno()).date() | 2768 | if (CFiledata(bk->anno()).date() |
2768 | != fnstat.st_mtime) | 2769 | != fnstat.st_mtime) |
2769 | { | 2770 | { |
2770 | CFiledata fd(bk->anno()); | 2771 | CFiledata fd(bk->anno()); |
2771 | fd.setdate(fnstat.st_mtime); | 2772 | fd.setdate(fnstat.st_mtime); |
2772 | bk->value(0); | 2773 | bk->value(0); |
2773 | } | ||
2774 | else | ||
2775 | { | ||
2776 | unsigned short svlen = bk->filedatalen(); | ||
2777 | unsigned char* svdata = bk->filedata(); | ||
2778 | reader->putSaveData(svdata, svlen); | ||
2779 | // setstate(svdata, svlen); | ||
2780 | if (svlen != 0) | ||
2781 | { | ||
2782 | QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?"); | ||
2783 | } | ||
2784 | // qDebug("updating"); | ||
2785 | // showEditTools(); | ||
2786 | reader->locate(bk->value()); | ||
2787 | } | ||
2788 | return true; | ||
2789 | } | 2774 | } |
2790 | else | 2775 | else |
2791 | { | 2776 | { |
2792 | return false; | 2777 | unsigned short svlen = bk->filedatalen(); |
2778 | unsigned char* svdata = bk->filedata(); | ||
2779 | reader->putSaveData(svdata, svlen); | ||
2780 | // setstate(svdata, svlen); | ||
2781 | if (svlen != 0) | ||
2782 | { | ||
2783 | QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?"); | ||
2784 | } | ||
2785 | // odebug << "updating" << oendl; | ||
2786 | // showEditTools(); | ||
2787 | reader->locate(bk->value()); | ||
2788 | } | ||
2789 | return true; | ||
2790 | } | ||
2791 | else | ||
2792 | { | ||
2793 | return false; | ||
2793 | } | 2794 | } |
2794 | } | 2795 | } |
2795 | 2796 | ||
@@ -2798,152 +2799,152 @@ void QTReaderApp::gotobkmk(int ind) | |||
2798 | showEditTools(); | 2799 | showEditTools(); |
2799 | switch (m_nBkmkAction) | 2800 | switch (m_nBkmkAction) |
2800 | { | 2801 | { |
2801 | case cOpenFile: | 2802 | case cOpenFile: |
2802 | { | 2803 | { |
2803 | // qApp->processEvents(); | 2804 | // qApp->processEvents(); |
2804 | if (!openfrombkmk((*pOpenlist)[ind])) | 2805 | if (!openfrombkmk((*pOpenlist)[ind])) |
2805 | { | 2806 | { |
2806 | pOpenlist->erase(ind); | 2807 | pOpenlist->erase(ind); |
2807 | QMessageBox::information(this, PROGNAME, "Can't find file"); | 2808 | QMessageBox::information(this, PROGNAME, "Can't find file"); |
2808 | } | 2809 | } |
2809 | } | 2810 | } |
2810 | break; | 2811 | break; |
2811 | case cGotoBkmk: | 2812 | case cGotoBkmk: |
2812 | reader->locate((*pBkmklist)[ind]->value()); | 2813 | reader->locate((*pBkmklist)[ind]->value()); |
2813 | break; | 2814 | break; |
2814 | case cDelBkmk: | 2815 | case cDelBkmk: |
2815 | //// qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name()); | 2816 | //// odebug << "Deleting:" << (*pBkmklist)[ind]->name() << "\n" << oendl; |
2816 | pBkmklist->erase(ind); | 2817 | pBkmklist->erase(ind); |
2817 | m_fBkmksChanged = true; | 2818 | m_fBkmksChanged = true; |
2818 | // pBkmklist->sort(); | 2819 | // pBkmklist->sort(); |
2819 | break; | 2820 | break; |
2820 | case cRmBkmkFile: | 2821 | case cRmBkmkFile: |
2821 | { | 2822 | { |
2822 | #ifndef USEQPE | 2823 | #ifndef USEQPE |
2823 | QDir d = QDir::home(); // "/" | 2824 | QDir d = QDir::home(); // "/" |
2824 | d.cd(APPDIR); | 2825 | d.cd(APPDIR); |
2825 | d.remove(bkmkselector->text(ind)); | 2826 | d.remove(bkmkselector->text(ind)); |
2826 | #else /* USEQPE */ | 2827 | #else /* USEQPE */ |
2827 | unlink((const char *)Global::applicationFileName(APPDIR,bkmkselector->text(ind))); | 2828 | unlink((const char *)Global::applicationFileName(APPDIR,bkmkselector->text(ind))); |
2828 | #endif /* USEQPE */ | 2829 | #endif /* USEQPE */ |
2829 | } | 2830 | } |
2830 | break; | 2831 | break; |
2831 | case cLdConfig: | 2832 | case cLdConfig: |
2832 | readconfig(bkmkselector->text(ind), false); | 2833 | readconfig(bkmkselector->text(ind), false); |
2833 | break; | 2834 | break; |
2834 | case cRmConfig: | 2835 | case cRmConfig: |
2835 | { | 2836 | { |
2836 | #ifndef USEQPE | 2837 | #ifndef USEQPE |
2837 | QDir d = QDir::home(); // "/" | 2838 | QDir d = QDir::home(); // "/" |
2838 | d.cd(APPDIR "/configs"); | 2839 | d.cd(APPDIR "/configs"); |
2839 | d.remove(bkmkselector->text(ind)); | 2840 | d.remove(bkmkselector->text(ind)); |
2840 | #else /* USEQPE */ | 2841 | #else /* USEQPE */ |
2841 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",bkmkselector->text(ind))); | 2842 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",bkmkselector->text(ind))); |
2842 | #endif /* USEQPE */ | 2843 | #endif /* USEQPE */ |
2843 | } | 2844 | } |
2844 | break; | 2845 | break; |
2845 | case cExportLinks: | 2846 | case cExportLinks: |
2846 | { | 2847 | { |
2847 | #ifndef USEQPE | 2848 | #ifndef USEQPE |
2848 | QDir d = QDir::home(); // "/" | 2849 | QDir d = QDir::home(); // "/" |
2849 | d.cd(APPDIR "/urls"); | 2850 | d.cd(APPDIR "/urls"); |
2850 | QFileInfo fi(d, bkmkselector->text(ind)); | 2851 | QFileInfo fi(d, bkmkselector->text(ind)); |
2851 | if (fi.exists()) | 2852 | if (fi.exists()) |
2852 | { | 2853 | { |
2853 | QString outfile( QFileDialog::getSaveFileName( QString::null, QString::null, this ) ); | 2854 | QString outfile( QFileDialog::getSaveFileName( QString::null, QString::null, this ) ); |
2854 | if (!outfile.isEmpty()) | 2855 | if (!outfile.isEmpty()) |
2855 | { | 2856 | { |
2856 | FILE* fout = fopen((const char *)outfile, "w"); | 2857 | FILE* fout = fopen((const char *)outfile, "w"); |
2857 | if (fout != NULL) | 2858 | if (fout != NULL) |
2858 | { | 2859 | { |
2859 | FILE* fin = fopen((const char *)fi.absFilePath(), "r"); | 2860 | FILE* fin = fopen((const char *)fi.absFilePath(), "r"); |
2860 | if (fin != NULL) | 2861 | if (fin != NULL) |
2861 | { | 2862 | { |
2862 | fprintf(fout, "<html><body>\n"); | 2863 | fprintf(fout, "<html><body>\n"); |
2863 | int ch = 0; | 2864 | int ch = 0; |
2864 | while ((ch = fgetc(fin)) != EOF) | 2865 | while ((ch = fgetc(fin)) != EOF) |
2865 | { | 2866 | { |
2866 | fputc(ch, fout); | 2867 | fputc(ch, fout); |
2867 | } | 2868 | } |
2868 | fclose(fin); | 2869 | fclose(fin); |
2869 | fprintf(fout, "</html></body>\n"); | 2870 | fprintf(fout, "</html></body>\n"); |
2870 | d.remove(bkmkselector->text(ind)); | 2871 | d.remove(bkmkselector->text(ind)); |
2871 | } | 2872 | } |
2872 | fclose(fout); | 2873 | fclose(fout); |
2873 | } | 2874 | } |
2874 | else | 2875 | else |
2875 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); | 2876 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); |
2876 | } | 2877 | } |
2877 | } | 2878 | } |
2878 | #else /* USEQPE */ | 2879 | #else /* USEQPE */ |
2879 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); | 2880 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); |
2880 | if (fin != NULL) | 2881 | if (fin != NULL) |
2881 | { | 2882 | { |
2882 | bool allok = false; | 2883 | bool allok = false; |
2883 | fileBrowser* fb = new fileBrowser(true, this,"OpieReader",!m_bFloatingDialog, 0, "*", QString::null); | 2884 | fileBrowser* fb = new fileBrowser(true, this,"OpieReader",!m_bFloatingDialog, 0, "*", QString::null); |
2884 | if (fb->exec()) | 2885 | if (fb->exec()) |
2885 | { | 2886 | { |
2886 | QString outfile = fb->getCurrentFile(); | 2887 | QString outfile = fb->getCurrentFile(); |
2887 | FILE* fout = fopen((const char *)outfile, "w"); | 2888 | FILE* fout = fopen((const char *)outfile, "w"); |
2888 | if (fout != NULL) | 2889 | if (fout != NULL) |
2889 | { | 2890 | { |
2890 | fprintf(fout, "<html><body>\n"); | 2891 | fprintf(fout, "<html><body>\n"); |
2891 | int ch = 0; | 2892 | int ch = 0; |
2892 | while ((ch = fgetc(fin)) != EOF) | 2893 | while ((ch = fgetc(fin)) != EOF) |
2893 | { | 2894 | { |
2894 | fputc(ch, fout); | 2895 | fputc(ch, fout); |
2895 | } | 2896 | } |
2896 | fprintf(fout, "</html></body>\n"); | 2897 | fprintf(fout, "</html></body>\n"); |
2897 | fclose(fout); | 2898 | fclose(fout); |
2898 | allok = true; | 2899 | allok = true; |
2899 | } | 2900 | } |
2900 | else | 2901 | else |
2901 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); | 2902 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); |
2902 | } | 2903 | } |
2903 | delete fb; | 2904 | delete fb; |
2904 | fclose(fin); | 2905 | fclose(fin); |
2905 | if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); | 2906 | if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); |
2906 | } | 2907 | } |
2907 | else | 2908 | else |
2908 | { | 2909 | { |
2909 | QMessageBox::information(this, PROGNAME, "Couldn't open input"); | 2910 | QMessageBox::information(this, PROGNAME, "Couldn't open input"); |
2910 | } | 2911 | } |
2911 | 2912 | ||
2912 | /* | 2913 | /* |
2913 | CFileSelector *f = new CFileSelector("text/html", this, NULL, !m_bFloatingDialog, TRUE, TRUE ); | 2914 | CFileSelector *f = new CFileSelector("text/html", this, NULL, !m_bFloatingDialog, TRUE, TRUE ); |
2914 | int ret = f->exec(); | 2915 | int ret = f->exec(); |
2915 | qDebug("Return:%d", ret); | 2916 | odebug << "Return:" << ret << "" << oendl; |
2916 | DocLnk* doc = f->getDoc(); | 2917 | DocLnk* doc = f->getDoc(); |
2917 | if (doc != NULL) | 2918 | if (doc != NULL) |
2918 | { | 2919 | { |
2919 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); | 2920 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); |
2920 | QString rt; | 2921 | QString rt; |
2921 | rt = "<html><body>\n"; | 2922 | rt = "<html><body>\n"; |
2922 | int ch = 0; | 2923 | int ch = 0; |
2923 | while ((ch = fgetc(fin)) != EOF) | 2924 | while ((ch = fgetc(fin)) != EOF) |
2924 | { | 2925 | { |
2925 | rt += (char)ch; | 2926 | rt += (char)ch; |
2926 | } | 2927 | } |
2927 | fclose(fin); | 2928 | fclose(fin); |
2928 | rt += "</html></body>\n"; | 2929 | rt += "</html></body>\n"; |
2929 | if ( doc->name().isEmpty() ) | 2930 | if ( doc->name().isEmpty() ) |
2930 | { | 2931 | { |
2931 | doc->setName(bkmkselector->text(ind)); | 2932 | doc->setName(bkmkselector->text(ind)); |
2932 | } | 2933 | } |
2933 | FileManager fm; | 2934 | FileManager fm; |
2934 | fm.saveFile( *doc, rt ); | 2935 | fm.saveFile( *doc, rt ); |
2935 | qDebug("YES"); | 2936 | odebug << "YES" << oendl; |
2936 | } | 2937 | } |
2937 | else | 2938 | else |
2938 | { | 2939 | { |
2939 | qDebug("NO"); | 2940 | odebug << "NO" << oendl; |
2940 | } | 2941 | } |
2941 | delete f; | 2942 | delete f; |
2942 | */ | 2943 | */ |
2943 | 2944 | ||
2944 | #endif /* USEQPE */ | 2945 | #endif /* USEQPE */ |
2945 | } | 2946 | } |
2946 | break; | 2947 | break; |
2947 | } | 2948 | } |
2948 | } | 2949 | } |
2949 | 2950 | ||
@@ -2951,8 +2952,8 @@ void QTReaderApp::cancelbkmk() | |||
2951 | { | 2952 | { |
2952 | if (m_nBkmkAction == cOpenFile) | 2953 | if (m_nBkmkAction == cOpenFile) |
2953 | { | 2954 | { |
2954 | QString fn = usefilebrowser(); | 2955 | QString fn = usefilebrowser(); |
2955 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn); | 2956 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn); |
2956 | } | 2957 | } |
2957 | showEditTools(); | 2958 | showEditTools(); |
2958 | } | 2959 | } |
@@ -2971,9 +2972,9 @@ void QTReaderApp::do_jump(const QString& lcn) | |||
2971 | bool ok; | 2972 | bool ok; |
2972 | unsigned long ulcn = lcn.toULong(&ok); | 2973 | unsigned long ulcn = lcn.toULong(&ok); |
2973 | if (ok) | 2974 | if (ok) |
2974 | reader->locate(ulcn); | 2975 | reader->locate(ulcn); |
2975 | else | 2976 | else |
2976 | QMessageBox::information(this, PROGNAME, "Must be a number"); | 2977 | QMessageBox::information(this, PROGNAME, "Must be a number"); |
2977 | } | 2978 | } |
2978 | 2979 | ||
2979 | void QTReaderApp::do_regaction() | 2980 | void QTReaderApp::do_regaction() |
@@ -2987,31 +2988,31 @@ void QTReaderApp::do_regaction() | |||
2987 | switch(m_nRegAction) | 2988 | switch(m_nRegAction) |
2988 | { | 2989 | { |
2989 | case cAutoGen: | 2990 | case cAutoGen: |
2990 | do_autogen(regEdit->text()); | 2991 | do_autogen(regEdit->text()); |
2991 | break; | 2992 | break; |
2992 | case cAddBkmk: | 2993 | case cAddBkmk: |
2993 | do_addbkmk(regEdit->text()); | 2994 | do_addbkmk(regEdit->text()); |
2994 | break; | 2995 | break; |
2995 | case cJump: | 2996 | case cJump: |
2996 | do_jump(regEdit->text()); | 2997 | do_jump(regEdit->text()); |
2997 | break; | 2998 | break; |
2998 | /* | 2999 | /* |
2999 | case cMonoSpace: | 3000 | case cMonoSpace: |
3000 | do_mono(regEdit->text()); | 3001 | do_mono(regEdit->text()); |
3001 | break; | 3002 | break; |
3002 | */ | 3003 | */ |
3003 | case cSetTarget: | 3004 | case cSetTarget: |
3004 | do_settarget(regEdit->text()); | 3005 | do_settarget(regEdit->text()); |
3005 | break; | 3006 | break; |
3006 | #ifdef _SCROLLPIPE | 3007 | #ifdef _SCROLLPIPE |
3007 | case cSetPipeTarget: | 3008 | case cSetPipeTarget: |
3008 | do_setpipetarget(regEdit->text()); | 3009 | do_setpipetarget(regEdit->text()); |
3009 | break; | 3010 | break; |
3010 | #endif | 3011 | #endif |
3011 | case cSetConfigName: | 3012 | case cSetConfigName: |
3012 | // qDebug("Saving config"); | 3013 | // odebug << "Saving config" << oendl; |
3013 | do_saveconfig(regEdit->text(), false); | 3014 | do_saveconfig(regEdit->text(), false); |
3014 | break; | 3015 | break; |
3015 | } | 3016 | } |
3016 | // reader->restore(); | 3017 | // reader->restore(); |
3017 | // fileBar->show(); | 3018 | // fileBar->show(); |
@@ -3026,14 +3027,14 @@ void QTReaderApp::do_settarget(const QString& _txt) | |||
3026 | int ind = _txt.find('/'); | 3027 | int ind = _txt.find('/'); |
3027 | if (ind == -1) | 3028 | if (ind == -1) |
3028 | { | 3029 | { |
3029 | m_targetapp = ""; | 3030 | m_targetapp = ""; |
3030 | m_targetmsg = ""; | 3031 | m_targetmsg = ""; |
3031 | QMessageBox::information(this, PROGNAME, "Format is\nappname/messagename"); | 3032 | QMessageBox::information(this, PROGNAME, "Format is\nappname/messagename"); |
3032 | } | 3033 | } |
3033 | else | 3034 | else |
3034 | { | 3035 | { |
3035 | m_targetapp = _txt.left(ind); | 3036 | m_targetapp = _txt.left(ind); |
3036 | m_targetmsg = _txt.right(_txt.length()-ind-1); | 3037 | m_targetmsg = _txt.right(_txt.length()-ind-1); |
3037 | } | 3038 | } |
3038 | } | 3039 | } |
3039 | 3040 | ||
@@ -3047,7 +3048,7 @@ void QTReaderApp::chooseencoding() | |||
3047 | m_fontSelector->insertItem("Palm"); | 3048 | m_fontSelector->insertItem("Palm"); |
3048 | for (unicodetable::iterator iter = unicodetable::begin(); iter != unicodetable::end(); iter++) | 3049 | for (unicodetable::iterator iter = unicodetable::begin(); iter != unicodetable::end(); iter++) |
3049 | { | 3050 | { |
3050 | m_fontSelector->insertItem(iter->mime); | 3051 | m_fontSelector->insertItem(iter->mime); |
3051 | } // delete the FontDatabase!!! | 3052 | } // delete the FontDatabase!!! |
3052 | m_fontSelector->setCurrentItem (reader->m_encd); | 3053 | m_fontSelector->setCurrentItem (reader->m_encd); |
3053 | m_fontAction = cChooseEncoding; | 3054 | m_fontAction = cChooseEncoding; |
@@ -3060,21 +3061,21 @@ void QTReaderApp::setfont() | |||
3060 | m_fontSelector->clear(); | 3061 | m_fontSelector->clear(); |
3061 | { | 3062 | { |
3062 | #ifdef USEQPE | 3063 | #ifdef USEQPE |
3063 | FontDatabase f; | 3064 | FontDatabase f; |
3064 | #else | 3065 | #else |
3065 | QFontDatabase f; | 3066 | QFontDatabase f; |
3066 | #endif | 3067 | #endif |
3067 | QStringList flist = f.families(); | 3068 | QStringList flist = f.families(); |
3068 | m_fontSelector->insertStringList(flist); | 3069 | m_fontSelector->insertStringList(flist); |
3069 | } // delete the FontDatabase!!! | 3070 | } // delete the FontDatabase!!! |
3070 | 3071 | ||
3071 | for (int i = 1; i <= m_fontSelector->count(); i++) | 3072 | for (int i = 1; i <= m_fontSelector->count(); i++) |
3072 | { | 3073 | { |
3073 | if (m_fontSelector->text(i) == reader->m_fontname) | 3074 | if (m_fontSelector->text(i) == reader->m_fontname) |
3074 | { | 3075 | { |
3075 | m_fontSelector->setCurrentItem(i); | 3076 | m_fontSelector->setCurrentItem(i); |
3076 | break; | 3077 | break; |
3077 | } | 3078 | } |
3078 | } | 3079 | } |
3079 | m_fontAction = cChooseFont; | 3080 | m_fontAction = cChooseFont; |
3080 | m_fontBar->show(); | 3081 | m_fontBar->show(); |
@@ -3086,54 +3087,54 @@ void QTReaderApp::setfontHelper(const QString& lcn, int size) | |||
3086 | if (size == 0) size = reader->m_fontControl.currentsize(); | 3087 | if (size == 0) size = reader->m_fontControl.currentsize(); |
3087 | if (m_propogatefontchange) | 3088 | if (m_propogatefontchange) |
3088 | { | 3089 | { |
3089 | QFont f(lcn, 10); | 3090 | QFont f(lcn, 10); |
3090 | bkmkselector->setFont( f ); | 3091 | bkmkselector->setFont( f ); |
3091 | regEdit->setFont( f ); | 3092 | regEdit->setFont( f ); |
3092 | searchEdit->setFont( f ); | 3093 | searchEdit->setFont( f ); |
3093 | m_annoWin->setFont( f ); | 3094 | m_annoWin->setFont( f ); |
3094 | } | 3095 | } |
3095 | reader->m_fontname = lcn; | 3096 | reader->m_fontname = lcn; |
3096 | if (!reader->ChangeFont(size)) | 3097 | if (!reader->ChangeFont(size)) |
3097 | { | 3098 | { |
3098 | reader->ChangeFont(size); | 3099 | reader->ChangeFont(size); |
3099 | } | 3100 | } |
3100 | } | 3101 | } |
3101 | 3102 | ||
3102 | void QTReaderApp::do_setencoding(int i) | 3103 | void QTReaderApp::do_setencoding(int i) |
3103 | { | 3104 | { |
3104 | // qDebug("setencoding:%d", i); | 3105 | // odebug << "setencoding:" << i << "" << oendl; |
3105 | if (m_fontAction == cChooseEncoding) | 3106 | if (m_fontAction == cChooseEncoding) |
3106 | { | 3107 | { |
3107 | reader->setencoding(i); | 3108 | reader->setencoding(i); |
3108 | } | 3109 | } |
3109 | reader->refresh(); | 3110 | reader->refresh(); |
3110 | m_fontBar->hide(); | 3111 | m_fontBar->hide(); |
3111 | m_fontVisible = false; | 3112 | m_fontVisible = false; |
3112 | // qDebug("showedit"); | 3113 | // odebug << "showedit" << oendl; |
3113 | if (reader->isVisible()) showEditTools(); | 3114 | if (reader->isVisible()) showEditTools(); |
3114 | // qDebug("showeditdone"); | 3115 | // odebug << "showeditdone" << oendl; |
3115 | } | 3116 | } |
3116 | 3117 | ||
3117 | void QTReaderApp::do_setfont(const QString& lcn) | 3118 | void QTReaderApp::do_setfont(const QString& lcn) |
3118 | { | 3119 | { |
3119 | if (m_fontAction == cChooseFont) | 3120 | if (m_fontAction == cChooseFont) |
3120 | { | 3121 | { |
3121 | setfontHelper(lcn); | 3122 | setfontHelper(lcn); |
3122 | } | 3123 | } |
3123 | reader->refresh(); | 3124 | reader->refresh(); |
3124 | m_fontBar->hide(); | 3125 | m_fontBar->hide(); |
3125 | m_fontVisible = false; | 3126 | m_fontVisible = false; |
3126 | // qDebug("showedit"); | 3127 | // odebug << "showedit" << oendl; |
3127 | //if (reader->isVisible()) | 3128 | //if (reader->isVisible()) |
3128 | showEditTools(); | 3129 | showEditTools(); |
3129 | // qDebug("showeditdone"); | 3130 | // odebug << "showeditdone" << oendl; |
3130 | } | 3131 | } |
3131 | 3132 | ||
3132 | void QTReaderApp::do_autogen(const QString& regText) | 3133 | void QTReaderApp::do_autogen(const QString& regText) |
3133 | { | 3134 | { |
3134 | unsigned long fs, ts; | 3135 | unsigned long fs, ts; |
3135 | reader->sizes(fs,ts); | 3136 | reader->sizes(fs,ts); |
3136 | // // qDebug("Reg:%s\n", (const tchar*)(regEdit->text())); | 3137 | // // odebug << "Reg:" << (const tchar*)(regEdit->text()) << "\n" << oendl; |
3137 | m_autogenstr = regText; | 3138 | m_autogenstr = regText; |
3138 | QRegExp re(regText); | 3139 | QRegExp re(regText); |
3139 | CBuffer buff; | 3140 | CBuffer buff; |
@@ -3158,9 +3159,9 @@ void QTReaderApp::do_autogen(const QString& regText) | |||
3158 | if (pc != lastpc) | 3159 | if (pc != lastpc) |
3159 | { | 3160 | { |
3160 | pbar->setProgress(pc); | 3161 | pbar->setProgress(pc); |
3161 | qApp->processEvents(); | 3162 | qApp->processEvents(); |
3162 | if (reader->locate() != lcn) reader->jumpto(lcn); | 3163 | if (reader->locate() != lcn) reader->jumpto(lcn); |
3163 | reader->setFocus(); | 3164 | reader->setFocus(); |
3164 | lastpc = pc; | 3165 | lastpc = pc; |
3165 | } | 3166 | } |
3166 | i = reader->buffdoc.getpara(buff); | 3167 | i = reader->buffdoc.getpara(buff); |
@@ -3169,7 +3170,7 @@ void QTReaderApp::do_autogen(const QString& regText) | |||
3169 | #else | 3170 | #else |
3170 | if (re.match(buff.data()) != -1) | 3171 | if (re.match(buff.data()) != -1) |
3171 | #endif | 3172 | #endif |
3172 | pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); | 3173 | pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); |
3173 | } | 3174 | } |
3174 | pBkmklist->sort(); | 3175 | pBkmklist->sort(); |
3175 | pbar->setProgress(100); | 3176 | pbar->setProgress(100); |
@@ -3180,17 +3181,17 @@ void QTReaderApp::do_autogen(const QString& regText) | |||
3180 | 3181 | ||
3181 | void QTReaderApp::saveprefs() | 3182 | void QTReaderApp::saveprefs() |
3182 | { | 3183 | { |
3183 | // qDebug("saveprefs"); | 3184 | // odebug << "saveprefs" << oendl; |
3184 | // reader->saveprefs("uqtreader"); | 3185 | // reader->saveprefs("uqtreader"); |
3185 | // if (!m_loadedconfig) | 3186 | // if (!m_loadedconfig) |
3186 | do_saveconfig( APPDIR, true ); | 3187 | do_saveconfig( APPDIR, true ); |
3187 | 3188 | ||
3188 | /* | 3189 | /* |
3189 | Config config( APPDIR ); | 3190 | Config config( APPDIR ); |
3190 | config.setGroup( "View" ); | 3191 | config.setGroup( "View" ); |
3191 | 3192 | ||
3192 | reader->m_lastposn = reader->pagelocate(); | 3193 | reader->m_lastposn = reader->pagelocate(); |
3193 | 3194 | ||
3194 | config.writeEntry("FloatDialogs", m_bFloatingDialog); | 3195 | config.writeEntry("FloatDialogs", m_bFloatingDialog); |
3195 | config.writeEntry( "StripCr", reader->bstripcr ); | 3196 | config.writeEntry( "StripCr", reader->bstripcr ); |
3196 | config.writeEntry( "AutoFmt", reader->bautofmt ); | 3197 | config.writeEntry( "AutoFmt", reader->bautofmt ); |
@@ -3261,11 +3262,11 @@ void QTReaderApp::saveprefs() | |||
3261 | /* | 3262 | /* |
3262 | void QTReaderApp::oldFile() | 3263 | void QTReaderApp::oldFile() |
3263 | { | 3264 | { |
3264 | // qDebug("oldFile called"); | 3265 | // odebug << "oldFile called" << oendl; |
3265 | reader->setText(true); | 3266 | reader->setText(true); |
3266 | // qDebug("settext called"); | 3267 | // odebug << "settext called" << oendl; |
3267 | showEditTools(); | 3268 | showEditTools(); |
3268 | // qDebug("showedit called"); | 3269 | // odebug << "showedit called" << oendl; |
3269 | } | 3270 | } |
3270 | */ | 3271 | */ |
3271 | 3272 | ||
@@ -3275,40 +3276,40 @@ void info_cb(Fl_Widget* o, void* _data) | |||
3275 | 3276 | ||
3276 | if (infowin == NULL) | 3277 | if (infowin == NULL) |
3277 | { | 3278 | { |
3278 | 3279 | ||
3279 | infowin = new Fl_Window(160,240); | 3280 | infowin = new Fl_Window(160,240); |
3280 | filename = new Fl_Output(45,5,110,14,"Filename"); | 3281 | filename = new Fl_Output(45,5,110,14,"Filename"); |
3281 | filesize = new Fl_Output(45,25,110,14,"Filesize"); | 3282 | filesize = new Fl_Output(45,25,110,14,"Filesize"); |
3282 | textsize = new Fl_Output(45,45,110,14,"Textsize"); | 3283 | textsize = new Fl_Output(45,45,110,14,"Textsize"); |
3283 | comprat = new CBar(45,65,110,14,"Ratio %"); | 3284 | comprat = new CBar(45,65,110,14,"Ratio %"); |
3284 | posn = new Fl_Output(45,85,110,14,"Location"); | 3285 | posn = new Fl_Output(45,85,110,14,"Location"); |
3285 | frcn = new CBar(45,105,110,14,"% Read"); | 3286 | frcn = new CBar(45,105,110,14,"% Read"); |
3286 | about = new Fl_Multiline_Output(5,125,150,90); | 3287 | about = new Fl_Multiline_Output(5,125,150,90); |
3287 | about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files"); | 3288 | about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files"); |
3288 | Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay"); | 3289 | Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay"); |
3289 | infowin->set_modal(); | 3290 | infowin->set_modal(); |
3290 | } | 3291 | } |
3291 | if (((reader_ui *)_data)->g_filename[0] != '\0') | 3292 | if (((reader_ui *)_data)->g_filename[0] != '\0') |
3292 | { | 3293 | { |
3293 | unsigned long fs,ts; | 3294 | unsigned long fs,ts; |
3294 | tchar sz[20]; | 3295 | tchar sz[20]; |
3295 | ((reader_ui *)_data)->input->sizes(fs,ts); | 3296 | ((reader_ui *)_data)->input->sizes(fs,ts); |
3296 | unsigned long pl = ((reader_ui *)_data)->input->locate(); | 3297 | unsigned long pl = ((reader_ui *)_data)->input->locate(); |
3297 | 3298 | ||
3298 | filename->value(((reader_ui *)_data)->g_filename); | 3299 | filename->value(((reader_ui *)_data)->g_filename); |
3299 | 3300 | ||
3300 | sprintf(sz,"%u",fs); | 3301 | sprintf(sz,"%u",fs); |
3301 | filesize->value(sz); | 3302 | filesize->value(sz); |
3302 | 3303 | ||
3303 | sprintf(sz,"%u",ts); | 3304 | sprintf(sz,"%u",ts); |
3304 | textsize->value(sz); | 3305 | textsize->value(sz); |
3305 | 3306 | ||
3306 | comprat->value(100-(100*fs + (ts >> 1))/ts); | 3307 | comprat->value(100-(100*fs + (ts >> 1))/ts); |
3307 | 3308 | ||
3308 | sprintf(sz,"%u",pl); | 3309 | sprintf(sz,"%u",pl); |
3309 | posn->value(sz); | 3310 | posn->value(sz); |
3310 | 3311 | ||
3311 | frcn->value((100*pl + (ts >> 1))/ts); | 3312 | frcn->value((100*pl + (ts >> 1))/ts); |
3312 | } | 3313 | } |
3313 | infowin->show(); | 3314 | infowin->show(); |
3314 | } | 3315 | } |
@@ -3319,32 +3320,32 @@ void QTReaderApp::savebkmks() | |||
3319 | if (pBkmklist != NULL) | 3320 | if (pBkmklist != NULL) |
3320 | { | 3321 | { |
3321 | #ifndef USEQPE | 3322 | #ifndef USEQPE |
3322 | QDir d = QDir::home(); // "/" | 3323 | QDir d = QDir::home(); // "/" |
3323 | d.cd(APPDIR); | 3324 | d.cd(APPDIR); |
3324 | QFileInfo fi(d, reader->m_string); | 3325 | QFileInfo fi(d, reader->m_string); |
3325 | BkmkFile bf((const char *)fi.absFilePath(), true); | 3326 | BkmkFile bf((const char *)fi.absFilePath(), true); |
3326 | #else /* USEQPE */ | 3327 | #else /* USEQPE */ |
3327 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), true); | 3328 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), true); |
3328 | #endif /* USEQPE */ | 3329 | #endif /* USEQPE */ |
3329 | bf.write(*pBkmklist); | 3330 | bf.write(*pBkmklist); |
3330 | } | 3331 | } |
3331 | m_fBkmksChanged = false; | 3332 | m_fBkmksChanged = false; |
3332 | } | 3333 | } |
3333 | 3334 | ||
3334 | void QTReaderApp::readfilelist() | 3335 | void QTReaderApp::readfilelist() |
3335 | { | 3336 | { |
3336 | #ifndef USEQPE | 3337 | #ifndef USEQPE |
3337 | QDir d = QDir::home(); // "/" | 3338 | QDir d = QDir::home(); // "/" |
3338 | d.cd(APPDIR); | 3339 | d.cd(APPDIR); |
3339 | QFileInfo fi(d, ".openfiles"); | 3340 | QFileInfo fi(d, ".openfiles"); |
3340 | BkmkFile bf((const char *)fi.absFilePath()); | 3341 | BkmkFile bf((const char *)fi.absFilePath()); |
3341 | #else /* USEQPE */ | 3342 | #else /* USEQPE */ |
3342 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles")); | 3343 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles")); |
3343 | #endif /* USEQPE */ | 3344 | #endif /* USEQPE */ |
3344 | // qDebug("Reading open files"); | 3345 | // odebug << "Reading open files" << oendl; |
3345 | pOpenlist = bf.readall(); | 3346 | pOpenlist = bf.readall(); |
3346 | // if (pOpenlist != NULL) qDebug("...with success"); | 3347 | // if (pOpenlist != NULL) odebug << "...with success" << oendl; |
3347 | // else qDebug("...without success!"); | 3348 | // else odebug << "...without success!" << oendl; |
3348 | } | 3349 | } |
3349 | 3350 | ||
3350 | void QTReaderApp::savefilelist() | 3351 | void QTReaderApp::savefilelist() |
@@ -3352,15 +3353,15 @@ void QTReaderApp::savefilelist() | |||
3352 | if (pOpenlist != NULL) | 3353 | if (pOpenlist != NULL) |
3353 | { | 3354 | { |
3354 | #ifndef USEQPE | 3355 | #ifndef USEQPE |
3355 | QDir d = QDir::home(); // "/" | 3356 | QDir d = QDir::home(); // "/" |
3356 | d.cd(APPDIR); | 3357 | d.cd(APPDIR); |
3357 | QFileInfo fi(d, ".openfiles"); | 3358 | QFileInfo fi(d, ".openfiles"); |
3358 | BkmkFile bf((const char *)fi.absFilePath(), true); | 3359 | BkmkFile bf((const char *)fi.absFilePath(), true); |
3359 | #else /* USEQPE */ | 3360 | #else /* USEQPE */ |
3360 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), true); | 3361 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), true); |
3361 | #endif /* USEQPE */ | 3362 | #endif /* USEQPE */ |
3362 | //qDebug("Writing open files"); | 3363 | // odebug << "Writing open files" << oendl; |
3363 | bf.write(*pOpenlist); | 3364 | bf.write(*pOpenlist); |
3364 | } | 3365 | } |
3365 | } | 3366 | } |
3366 | 3367 | ||
@@ -3368,33 +3369,33 @@ void QTReaderApp::readbkmks() | |||
3368 | { | 3369 | { |
3369 | if (pBkmklist != NULL) | 3370 | if (pBkmklist != NULL) |
3370 | { | 3371 | { |
3371 | delete pBkmklist; | 3372 | delete pBkmklist; |
3372 | } | 3373 | } |
3373 | struct stat fnstat; | 3374 | struct stat fnstat; |
3374 | struct stat bkstat; | 3375 | struct stat bkstat; |
3375 | #ifndef USEQPE | 3376 | #ifndef USEQPE |
3376 | QDir d = QDir::home(); // "/" | 3377 | QDir d = QDir::home(); // "/" |
3377 | d.cd(APPDIR); | 3378 | d.cd(APPDIR); |
3378 | QFileInfo fi(d, reader->m_string); | 3379 | QFileInfo fi(d, reader->m_string); |
3379 | #endif /* ! USEQPE */ | 3380 | #endif /* ! USEQPE */ |
3380 | if ( | 3381 | if ( |
3381 | stat((const char *)reader->m_lastfile, &fnstat) == 0 | 3382 | stat((const char *)reader->m_lastfile, &fnstat) == 0 |
3382 | && | 3383 | && |
3383 | #ifndef USEQPE | 3384 | #ifndef USEQPE |
3384 | stat((const char *)fi.absFilePath(), &bkstat) == 0 | 3385 | stat((const char *)fi.absFilePath(), &bkstat) == 0 |
3385 | #else /* USEQPE */ | 3386 | #else /* USEQPE */ |
3386 | stat((const char *)Global::applicationFileName(APPDIR,reader->m_string), &bkstat) == 0 | 3387 | stat((const char *)Global::applicationFileName(APPDIR,reader->m_string), &bkstat) == 0 |
3387 | #endif /* USEQPE */ | 3388 | #endif /* USEQPE */ |
3388 | ) | 3389 | ) |
3390 | { | ||
3391 | if (bkstat.st_mtime < fnstat.st_mtime) | ||
3389 | { | 3392 | { |
3390 | if (bkstat.st_mtime < fnstat.st_mtime) | ||
3391 | { | ||
3392 | #ifndef USEQPE | 3393 | #ifndef USEQPE |
3393 | unlink((const char *)fi.absFilePath()); | 3394 | unlink((const char *)fi.absFilePath()); |
3394 | #else /* USEQPE */ | 3395 | #else /* USEQPE */ |
3395 | unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); | 3396 | unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); |
3396 | #endif /* USEQPE */ | 3397 | #endif /* USEQPE */ |
3397 | } | 3398 | } |
3398 | } | 3399 | } |
3399 | 3400 | ||
3400 | #ifndef USEQPE | 3401 | #ifndef USEQPE |
@@ -3407,10 +3408,10 @@ void QTReaderApp::readbkmks() | |||
3407 | m_fBkmksChanged = bf.upgraded(); | 3408 | m_fBkmksChanged = bf.upgraded(); |
3408 | if (pBkmklist == NULL) | 3409 | if (pBkmklist == NULL) |
3409 | { | 3410 | { |
3410 | pBkmklist = reader->getbkmklist(); | 3411 | pBkmklist = reader->getbkmklist(); |
3411 | } | 3412 | } |
3412 | if (pBkmklist != NULL) | 3413 | if (pBkmklist != NULL) |
3413 | pBkmklist->sort(); | 3414 | pBkmklist->sort(); |
3414 | } | 3415 | } |
3415 | 3416 | ||
3416 | void QTReaderApp::addbkmk() | 3417 | void QTReaderApp::addbkmk() |
@@ -3422,36 +3423,36 @@ void QTReaderApp::addbkmk() | |||
3422 | 3423 | ||
3423 | void QTReaderApp::do_addbkmk(const QString& text) | 3424 | void QTReaderApp::do_addbkmk(const QString& text) |
3424 | { | 3425 | { |
3425 | if (text.isEmpty()) | 3426 | if (text.isEmpty()) |
3426 | { | 3427 | { |
3427 | QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nSelect add again", 1); | 3428 | QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nSelect add again", 1); |
3428 | } | 3429 | } |
3429 | else | 3430 | else |
3430 | { | 3431 | { |
3431 | if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>; | 3432 | if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>; |
3432 | #ifdef _UNICODE | 3433 | #ifdef _UNICODE |
3433 | CBuffer buff; | 3434 | CBuffer buff; |
3434 | int i = 0; | 3435 | int i = 0; |
3435 | for (i = 0; i < text.length(); i++) | 3436 | for (i = 0; i < text.length(); i++) |
3436 | { | 3437 | { |
3437 | buff[i] = text[i].unicode(); | 3438 | buff[i] = text[i].unicode(); |
3438 | } | 3439 | } |
3439 | buff[i] = 0; | 3440 | buff[i] = 0; |
3440 | pBkmklist->push_front(Bkmk(buff.data(), NULL, reader->pagelocate())); | 3441 | pBkmklist->push_front(Bkmk(buff.data(), NULL, reader->pagelocate())); |
3441 | #else | 3442 | #else |
3442 | pBkmklist->push_front(Bkmk((const tchar*)text, reader->pagelocate())); | 3443 | pBkmklist->push_front(Bkmk((const tchar*)text, reader->pagelocate())); |
3443 | #endif | 3444 | #endif |
3444 | m_fBkmksChanged = true; | 3445 | m_fBkmksChanged = true; |
3445 | pBkmklist->sort(); | 3446 | pBkmklist->sort(); |
3446 | } | 3447 | } |
3447 | } | 3448 | } |
3448 | 3449 | ||
3449 | void QTReaderApp::OnRedraw() | 3450 | void QTReaderApp::OnRedraw() |
3450 | { | 3451 | { |
3451 | if ((pBkmklist != NULL) && (m_bkmkAvail != NULL)) | 3452 | if ((pBkmklist != NULL) && (m_bkmkAvail != NULL)) |
3452 | { | 3453 | { |
3453 | bool found = findNextBookmark(reader->pagelocate()); | 3454 | bool found = findNextBookmark(reader->pagelocate()); |
3454 | m_bkmkAvail->setEnabled(found); | 3455 | m_bkmkAvail->setEnabled(found); |
3455 | } | 3456 | } |
3456 | } | 3457 | } |
3457 | 3458 | ||
@@ -3469,43 +3470,43 @@ void QTReaderApp::showAnnotation() | |||
3469 | 3470 | ||
3470 | void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, const QString& line) | 3471 | void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, const QString& line) |
3471 | { | 3472 | { |
3472 | //// qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd); | 3473 | //// odebug << "OnWordSelected(" << posn << "):" << wrd << "" << oendl; |
3473 | 3474 | ||
3474 | if (m_doClipboard) | 3475 | if (m_doClipboard) |
3475 | { | 3476 | { |
3476 | QClipboard* cb = QApplication::clipboard(); | 3477 | QClipboard* cb = QApplication::clipboard(); |
3477 | cb->setText(wrd); | 3478 | cb->setText(wrd); |
3478 | #ifdef USEQPE | 3479 | #ifdef USEQPE |
3479 | if (wrd.length() > 10) | 3480 | if (wrd.length() > 10) |
3480 | { | 3481 | { |
3481 | Global::statusMessage(wrd.left(8) + ".."); | 3482 | Global::statusMessage(wrd.left(8) + ".."); |
3482 | } | 3483 | } |
3483 | else | 3484 | else |
3484 | { | 3485 | { |
3485 | Global::statusMessage(wrd); | 3486 | Global::statusMessage(wrd); |
3486 | } | 3487 | } |
3487 | #endif | 3488 | #endif |
3488 | } | 3489 | } |
3489 | if (m_doAnnotation) | 3490 | if (m_doAnnotation) |
3490 | { | 3491 | { |
3491 | //addAnno(wrd, "Need to be able to edit this", posn); | 3492 | // addAnno(wrd, "Need to be able to edit this", posn); |
3492 | m_annoWin->setName(line); | 3493 | m_annoWin->setName(line); |
3493 | m_annoWin->setAnno(""); | 3494 | m_annoWin->setAnno(""); |
3494 | m_annoWin->setPosn(posn); | 3495 | m_annoWin->setPosn(posn); |
3495 | m_annoIsEditing = true; | 3496 | m_annoIsEditing = true; |
3496 | #ifdef USEQPE | 3497 | #ifdef USEQPE |
3497 | Global::showInputMethod(); | 3498 | Global::showInputMethod(); |
3498 | #endif | 3499 | #endif |
3499 | editorStack->raiseWidget( m_annoWin ); | 3500 | editorStack->raiseWidget( m_annoWin ); |
3500 | } | 3501 | } |
3501 | #ifdef USEQPE | 3502 | #ifdef USEQPE |
3502 | if (m_doDictionary) | 3503 | if (m_doDictionary) |
3503 | { | 3504 | { |
3504 | if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty()) | 3505 | if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty()) |
3505 | { | 3506 | { |
3506 | QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8()); | 3507 | QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8()); |
3507 | e << wrd; | 3508 | e << wrd; |
3508 | } | 3509 | } |
3509 | } | 3510 | } |
3510 | #endif | 3511 | #endif |
3511 | } | 3512 | } |
@@ -3514,82 +3515,82 @@ void QTReaderApp::doAction(ActionTypes a, QKeyEvent* e) | |||
3514 | { | 3515 | { |
3515 | if (a == 0) | 3516 | if (a == 0) |
3516 | { | 3517 | { |
3517 | e->ignore(); | 3518 | e->ignore(); |
3518 | } | 3519 | } |
3519 | else | 3520 | else |
3520 | { | 3521 | { |
3521 | e->accept(); | 3522 | e->accept(); |
3522 | //qDebug("Accepted"); | 3523 | // odebug << "Accepted" << oendl; |
3523 | switch (a) | 3524 | switch (a) |
3524 | { | 3525 | { |
3525 | case cesOpenFile: | 3526 | case cesOpenFile: |
3526 | { | 3527 | { |
3527 | fileOpen(); | 3528 | fileOpen(); |
3528 | } | 3529 | } |
3529 | break; | 3530 | break; |
3530 | case cesAutoScroll: | 3531 | case cesAutoScroll: |
3531 | { | 3532 | { |
3532 | reader->setautoscroll(!reader->m_autoScroll); | 3533 | reader->setautoscroll(!reader->m_autoScroll); |
3533 | setScrollState(reader->m_autoScroll); | 3534 | setScrollState(reader->m_autoScroll); |
3534 | } | 3535 | } |
3535 | break; | 3536 | break; |
3536 | case cesActionMark: | 3537 | case cesActionMark: |
3537 | { | 3538 | { |
3538 | addbkmk(); | 3539 | addbkmk(); |
3539 | } | 3540 | } |
3540 | break; | 3541 | break; |
3541 | case cesFullScreen: | 3542 | case cesFullScreen: |
3542 | { | 3543 | { |
3543 | m_actFullscreen->setOn(!m_fullscreen); | 3544 | m_actFullscreen->setOn(!m_fullscreen); |
3544 | } | 3545 | } |
3545 | break; | 3546 | break; |
3546 | case cesActionAnno: | 3547 | case cesActionAnno: |
3547 | { | 3548 | { |
3548 | addanno(); | 3549 | addanno(); |
3549 | } | 3550 | } |
3550 | break; | 3551 | break; |
3551 | case cesZoomIn: | 3552 | case cesZoomIn: |
3552 | zoomin(); | 3553 | zoomin(); |
3553 | break; | 3554 | break; |
3554 | case cesZoomOut: | 3555 | case cesZoomOut: |
3555 | zoomout(); | 3556 | zoomout(); |
3556 | break; | 3557 | break; |
3557 | case cesBack: | 3558 | case cesBack: |
3558 | reader->goBack(); | 3559 | reader->goBack(); |
3559 | break; | 3560 | break; |
3560 | case cesForward: | 3561 | case cesForward: |
3561 | reader->goForward(); | 3562 | reader->goForward(); |
3562 | break; | 3563 | break; |
3563 | case cesHome: | 3564 | case cesHome: |
3564 | reader->goHome(); | 3565 | reader->goHome(); |
3565 | break; | 3566 | break; |
3566 | case cesPageUp: | 3567 | case cesPageUp: |
3567 | reader->dopageup(); | 3568 | reader->dopageup(); |
3568 | break; | 3569 | break; |
3569 | case cesPageDown: | 3570 | case cesPageDown: |
3570 | reader->dopagedn(); | 3571 | reader->dopagedn(); |
3571 | break; | 3572 | break; |
3572 | case cesLineUp: | 3573 | case cesLineUp: |
3573 | reader->lineUp(); | 3574 | reader->lineUp(); |
3574 | break; | 3575 | break; |
3575 | case cesLineDown: | 3576 | case cesLineDown: |
3576 | reader->lineDown(); | 3577 | reader->lineDown(); |
3577 | break; | 3578 | break; |
3578 | case cesStartDoc: | 3579 | case cesStartDoc: |
3579 | gotoStart(); | 3580 | gotoStart(); |
3580 | break; | 3581 | break; |
3581 | case cesEndDoc: | 3582 | case cesEndDoc: |
3582 | gotoEnd(); | 3583 | gotoEnd(); |
3583 | break; | 3584 | break; |
3584 | default: | 3585 | default: |
3585 | qDebug("Unknown ActionType:%u", a); | 3586 | odebug << "Unknown ActionType:" << a << "" << oendl; |
3586 | break; | 3587 | break; |
3587 | } | 3588 | } |
3588 | } | 3589 | } |
3589 | } | 3590 | } |
3590 | 3591 | ||
3591 | void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); } | 3592 | void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); } |
3592 | void QTReaderApp::restoreFocus() { reader->setFocus(); } | 3593 | void QTReaderApp::restoreFocus() { reader->setFocus(); } |
3593 | 3594 | ||
3594 | void QTReaderApp::SaveConfig() | 3595 | void QTReaderApp::SaveConfig() |
3595 | { | 3596 | { |
@@ -3600,62 +3601,62 @@ void QTReaderApp::SaveConfig() | |||
3600 | 3601 | ||
3601 | void QTReaderApp::do_saveconfig(const QString& _txt, bool full) | 3602 | void QTReaderApp::do_saveconfig(const QString& _txt, bool full) |
3602 | { | 3603 | { |
3603 | // qDebug("do_saveconfig:%s", (const char*)_txt); | 3604 | // odebug << "do_saveconfig:" << _txt << "" << oendl; |
3604 | #ifdef USEQPE | 3605 | #ifdef USEQPE |
3605 | QString configname; | 3606 | QString configname; |
3606 | Config::Domain dom; | 3607 | Config::Domain dom; |
3607 | 3608 | ||
3608 | if (full) | 3609 | if (full) |
3609 | { | 3610 | { |
3610 | configname = _txt; | 3611 | configname = _txt; |
3611 | dom = Config::User; | 3612 | dom = Config::User; |
3612 | } | 3613 | } |
3613 | else | 3614 | else |
3614 | { | 3615 | { |
3615 | configname = Global::applicationFileName(APPDIR "/configs", _txt); | 3616 | configname = Global::applicationFileName(APPDIR "/configs", _txt); |
3616 | dom = Config::File; | 3617 | dom = Config::File; |
3617 | } | 3618 | } |
3618 | 3619 | ||
3619 | Config config(configname, dom); | 3620 | Config config(configname, dom); |
3620 | config.setGroup( "View" ); | 3621 | config.setGroup( "View" ); |
3621 | 3622 | ||
3622 | #else | 3623 | #else |
3623 | QFileInfo fi; | 3624 | QFileInfo fi; |
3624 | if (full) | 3625 | if (full) |
3625 | { | 3626 | { |
3626 | // qDebug("full:%s", (const char*)_txt); | 3627 | // odebug << "full:" << _txt << "" << oendl; |
3627 | QDir d = QDir::home(); // "/" | 3628 | QDir d = QDir::home(); // "/" |
3628 | if ( !d.cd(_txt) ) | 3629 | if ( !d.cd(_txt) ) |
3629 | { // "/tmp" | 3630 | { // "/tmp" |
3630 | qWarning( "Cannot find the \"~/%s\" directory", (const char*)_txt ); | 3631 | owarn << "Cannot find the \"~/" << _txt << "\" directory" << oendl; |
3631 | d = QDir::home(); | 3632 | d = QDir::home(); |
3632 | d.mkdir(_txt); | 3633 | d.mkdir(_txt); |
3633 | d.cd(_txt); | 3634 | d.cd(_txt); |
3634 | } | 3635 | } |
3635 | fi.setFile(d, INIFILE); | 3636 | fi.setFile(d, INIFILE); |
3636 | } | 3637 | } |
3637 | else | 3638 | else |
3638 | { | 3639 | { |
3639 | QDir d = QDir::home(); // "/" | 3640 | QDir d = QDir::home(); // "/" |
3640 | if ( !d.cd(APPDIR) ) | 3641 | if ( !d.cd(APPDIR) ) |
3641 | { // "/tmp" | 3642 | { // "/tmp" |
3642 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 3643 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; |
3643 | d = QDir::home(); | 3644 | d = QDir::home(); |
3644 | d.mkdir(APPDIR); | 3645 | d.mkdir(APPDIR); |
3645 | d.cd(APPDIR); | 3646 | d.cd(APPDIR); |
3646 | } | 3647 | } |
3647 | if ( !d.cd("configs") ) | 3648 | if ( !d.cd("configs") ) |
3648 | { // "/tmp" | 3649 | { // "/tmp" |
3649 | qWarning( "Cannot find the \"~/" APPDIR "/configs\" directory" ); | 3650 | owarn << "Cannot find the \"~/" APPDIR "/configs\" directory" << oendl; |
3650 | d = QDir::home(); | 3651 | d = QDir::home(); |
3651 | d.cd(APPDIR); | 3652 | d.cd(APPDIR); |
3652 | d.mkdir("configs"); | 3653 | d.mkdir("configs"); |
3653 | d.cd("configs"); | 3654 | d.cd("configs"); |
3654 | } | 3655 | } |
3655 | fi.setFile(d, _txt); | 3656 | fi.setFile(d, _txt); |
3656 | } | 3657 | } |
3657 | //qDebug("Path:%s", (const char*)fi.absFilePath()); | 3658 | // odebug << "Path:" << fi.absFilePath() << "" << oendl; |
3658 | Config config(fi.absFilePath()); | 3659 | Config config(fi.absFilePath()); |
3659 | #endif | 3660 | #endif |
3660 | 3661 | ||
3661 | 3662 | ||
@@ -3675,11 +3676,11 @@ void QTReaderApp::do_saveconfig(const QString& _txt, bool full) | |||
3675 | config.writeEntry( "ScrollDelay", reader->m_delay); | 3676 | config.writeEntry( "ScrollDelay", reader->m_delay); |
3676 | if (full) | 3677 | if (full) |
3677 | { | 3678 | { |
3678 | config.writeEntry("Debounce", m_debounce); | 3679 | config.writeEntry("Debounce", m_debounce); |
3679 | config.writeEntry("FloatDialogs", m_bFloatingDialog); | 3680 | config.writeEntry("FloatDialogs", m_bFloatingDialog); |
3680 | reader->m_lastposn = reader->pagelocate(); | 3681 | reader->m_lastposn = reader->pagelocate(); |
3681 | config.writeEntry( "LastFile", reader->m_lastfile ); | 3682 | config.writeEntry( "LastFile", reader->m_lastfile ); |
3682 | config.writeEntry( "LastPosn", (int)(reader->pagelocate()) ); | 3683 | config.writeEntry( "LastPosn", (int)(reader->pagelocate()) ); |
3683 | } | 3684 | } |
3684 | config.writeEntry( "PageMode", reader->m_bpagemode ); | 3685 | config.writeEntry( "PageMode", reader->m_bpagemode ); |
3685 | config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced ); | 3686 | config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced ); |
@@ -3724,16 +3725,16 @@ void QTReaderApp::do_saveconfig(const QString& _txt, bool full) | |||
3724 | config.writeEntry( "RequestorFontChange", m_propogatefontchange); | 3725 | config.writeEntry( "RequestorFontChange", m_propogatefontchange); |
3725 | if (full) | 3726 | if (full) |
3726 | { | 3727 | { |
3727 | config.setGroup( "Toolbar" ); | 3728 | config.setGroup( "Toolbar" ); |
3728 | config.writeEntry("Movable", m_tbmovesave); | 3729 | config.writeEntry("Movable", m_tbmovesave); |
3729 | config.writeEntry("Policy", m_tbpolsave); | 3730 | config.writeEntry("Policy", m_tbpolsave); |
3730 | config.writeEntry("Position", m_tbposition); | 3731 | config.writeEntry("Position", m_tbposition); |
3731 | #ifndef USEQPE | 3732 | #ifndef USEQPE |
3732 | config.setGroup( "Geometry" ); | 3733 | config.setGroup( "Geometry" ); |
3733 | config.writeEntry( "x", x() ); | 3734 | config.writeEntry( "x", x() ); |
3734 | config.writeEntry( "y", y() ); | 3735 | config.writeEntry( "y", y() ); |
3735 | config.writeEntry( "width", width() ); | 3736 | config.writeEntry( "width", width() ); |
3736 | config.writeEntry( "height", height() ); | 3737 | config.writeEntry( "height", height() ); |
3737 | #endif | 3738 | #endif |
3738 | } | 3739 | } |
3739 | } | 3740 | } |
@@ -3749,7 +3750,7 @@ void QTReaderApp::setstate(unsigned char* _sd, unsigned short _sdlen) | |||
3749 | char* data; | 3750 | char* data; |
3750 | if (sdlen < sizeof(statedata)+1) | 3751 | if (sdlen < sizeof(statedata)+1) |
3751 | { | 3752 | { |
3752 | sdlen = sizeof(statedata)+1; | 3753 | sdlen = sizeof(statedata)+1; |
3753 | } | 3754 | } |
3754 | data = new char[sdlen]; | 3755 | data = new char[sdlen]; |
3755 | sd = (statedata*)data; | 3756 | sd = (statedata*)data; |
@@ -3801,19 +3802,19 @@ void QTReaderApp::getstate(unsigned char*& data, unsigned short& len) | |||
3801 | void QTReaderApp::RunScript() | 3802 | void QTReaderApp::RunScript() |
3802 | { | 3803 | { |
3803 | fileBrowser* fb = new fileBrowser(this,"OpieReader",!m_bFloatingDialog, | 3804 | fileBrowser* fb = new fileBrowser(this,"OpieReader",!m_bFloatingDialog, |
3804 | 0, | 3805 | 0, |
3805 | // WStyle_Customize | WStyle_NoBorderEx, | 3806 | // WStyle_Customize | WStyle_NoBorderEx, |
3806 | "*", Global::applicationFileName(APPDIR "/scripts", "")); | 3807 | "*", Global::applicationFileName(APPDIR "/scripts", "")); |
3807 | 3808 | ||
3808 | QString fn; | 3809 | QString fn; |
3809 | if (fb->exec()) | 3810 | if (fb->exec()) |
3810 | { | 3811 | { |
3811 | fn = fb->fileList[0]; | 3812 | fn = fb->fileList[0]; |
3812 | } | 3813 | } |
3813 | delete fb; | 3814 | delete fb; |
3814 | if ( !fn.isEmpty() && fork() == 0 ) | 3815 | if ( !fn.isEmpty() && fork() == 0 ) |
3815 | { | 3816 | { |
3816 | execlp((const char *)fn,(const char *)fn,NULL); | 3817 | execlp((const char *)fn,(const char *)fn,NULL); |
3817 | } | 3818 | } |
3818 | } | 3819 | } |
3819 | 3820 | ||
@@ -3823,47 +3824,47 @@ void QTReaderApp::SaveScript(const char* sname) | |||
3823 | if (f != NULL) | 3824 | if (f != NULL) |
3824 | { | 3825 | { |
3825 | #ifdef OPIE | 3826 | #ifdef OPIE |
3826 | fprintf(f, "#!/bin/sh\nmsg() {\n\tqcop QPE/Application/reader \"$1\" \"$2\" \"$3\"\n}\n"); | 3827 | fprintf(f, "#!/bin/sh\nmsg() {\n\tqcop QPE/Application/reader \"$1\" \"$2\" \"$3\"\n}\n"); |
3827 | #else | 3828 | #else |
3828 | fprintf(f, "#!/bin/bash\nmsg() {\n\tqcop QPE/Application/uqtreader \"$1\" \"$2\" \"$3\"\n}\n"); | 3829 | fprintf(f, "#!/bin/bash\nmsg() {\n\tqcop QPE/Application/uqtreader \"$1\" \"$2\" \"$3\"\n}\n"); |
3829 | #endif | 3830 | #endif |
3830 | fprintf(f, "msg \"Update(int)\" 0\n"); | 3831 | fprintf(f, "msg \"Update(int)\" 0\n"); |
3831 | fprintf(f, "msg \"Layout/StripCR(int)\" %d\n", (reader->bstripcr) ? 1:0); | 3832 | fprintf(f, "msg \"Layout/StripCR(int)\" %d\n", (reader->bstripcr) ? 1:0); |
3832 | if (reader->btextfmt) fprintf(f, "msg \"Markup(QString)\" \"Text\"\n"); | 3833 | if (reader->btextfmt) fprintf(f, "msg \"Markup(QString)\" \"Text\"\n"); |
3833 | else if (reader->bautofmt) fprintf(f, "msg \"Markup(QString)\" \"Auto\"\n"); | 3834 | else if (reader->bautofmt) fprintf(f, "msg \"Markup(QString)\" \"Auto\"\n"); |
3834 | else if (reader->bstriphtml) fprintf(f, "msg \"Markup(QString)\" \"HTML\"\n"); | 3835 | else if (reader->bstriphtml) fprintf(f, "msg \"Markup(QString)\" \"HTML\"\n"); |
3835 | else if (reader->bpeanut) fprintf(f, "msg \"Markup(QString)\" \"Peanut/PML\"\n"); | 3836 | else if (reader->bpeanut) fprintf(f, "msg \"Markup(QString)\" \"Peanut/PML\"\n"); |
3836 | else fprintf(f, "msg \"Markup(QString)\" \"None\"\n"); | 3837 | else fprintf(f, "msg \"Markup(QString)\" \"None\"\n"); |
3837 | fprintf(f, "msg \"Layout/Dehyphen(int)\" %d\n", (reader->bdehyphen) ? 1:0); | 3838 | fprintf(f, "msg \"Layout/Dehyphen(int)\" %d\n", (reader->bdehyphen) ? 1:0); |
3838 | fprintf(f, "msg \"Layout/Depluck(int)\" %d\n", (reader->bdepluck) ? 1:0); | 3839 | fprintf(f, "msg \"Layout/Depluck(int)\" %d\n", (reader->bdepluck) ? 1:0); |
3839 | fprintf(f, "msg \"Layout/Dejpluck(int)\" %d\n", (reader->bdejpluck) ? 1:0); | 3840 | fprintf(f, "msg \"Layout/Dejpluck(int)\" %d\n", (reader->bdejpluck) ? 1:0); |
3840 | fprintf(f, "msg \"Layout/SingleSpace(int)\" %d\n", (reader->bonespace) ? 1:0); | 3841 | fprintf(f, "msg \"Layout/SingleSpace(int)\" %d\n", (reader->bonespace) ? 1:0); |
3841 | fprintf(f, "msg \"Layout/Unindent(int)\" %d\n", (reader->bunindent) ? 1:0); | 3842 | fprintf(f, "msg \"Layout/Unindent(int)\" %d\n", (reader->bunindent) ? 1:0); |
3842 | fprintf(f, "msg \"Layout/Re-paragraph(int)\" %d\n", (reader->brepara) ? 1:0); | 3843 | fprintf(f, "msg \"Layout/Re-paragraph(int)\" %d\n", (reader->brepara) ? 1:0); |
3843 | fprintf(f, "msg \"Layout/DoubleSpace(int)\" %d\n", (reader->bdblspce) ? 1:0); | 3844 | fprintf(f, "msg \"Layout/DoubleSpace(int)\" %d\n", (reader->bdblspce) ? 1:0); |
3844 | fprintf(f, "msg \"Layout/Indent(int)\" %d\n", reader->bindenter); | 3845 | fprintf(f, "msg \"Layout/Indent(int)\" %d\n", reader->bindenter); |
3845 | fprintf(f, "msg \"Format/SetFont(QString,int)\" \"%s\" %d\n", (const char*)reader->m_fontname, reader->m_textsize); | 3846 | fprintf(f, "msg \"Format/SetFont(QString,int)\" \"%s\" %d\n", (const char*)reader->m_fontname, reader->m_textsize); |
3846 | fprintf(f, "msg \"Navigation/Page/LineScroll(int)\" %d\n", (reader->m_bpagemode) ? 1:0); | 3847 | fprintf(f, "msg \"Navigation/Page/LineScroll(int)\" %d\n", (reader->m_bpagemode) ? 1:0); |
3847 | fprintf(f, "msg \"Format/Ideogram/Word(int)\" %d\n", (reader->m_bMonoSpaced) ? 1:0); | 3848 | fprintf(f, "msg \"Format/Ideogram/Word(int)\" %d\n", (reader->m_bMonoSpaced) ? 1:0); |
3848 | fprintf(f, "msg \"Format/Encoding(QString)\" \"%s\"\n", (const char*)m_EncodingAction[reader->m_encd]->text()); | 3849 | fprintf(f, "msg \"Format/Encoding(QString)\" \"%s\"\n", (const char*)m_EncodingAction[reader->m_encd]->text()); |
3849 | fprintf(f, "msg \"Format/SetWidth(int)\" %d\n", reader->m_charpc); | 3850 | fprintf(f, "msg \"Format/SetWidth(int)\" %d\n", reader->m_charpc); |
3850 | fprintf(f, "msg \"Navigation/SetOverlap(int)\" %d\n", reader->m_overlap); | 3851 | fprintf(f, "msg \"Navigation/SetOverlap(int)\" %d\n", reader->m_overlap); |
3851 | fprintf(f, "msg \"Layout/Remap(int)\" %d\n", (reader->bremap) ? 1:0); | 3852 | fprintf(f, "msg \"Layout/Remap(int)\" %d\n", (reader->bremap) ? 1:0); |
3852 | fprintf(f, "msg \"Layout/Embolden(int)\" %d\n", (reader->bmakebold) ? 1:0); | 3853 | fprintf(f, "msg \"Layout/Embolden(int)\" %d\n", (reader->bmakebold) ? 1:0); |
3853 | fprintf(f, "msg \"File/Continuous(int)\" %d\n", (reader->m_continuousDocument) ? 1:0); | 3854 | fprintf(f, "msg \"File/Continuous(int)\" %d\n", (reader->m_continuousDocument) ? 1:0); |
3854 | fprintf(f, "msg \"File/SetDictionary(QString)\" \"%s/%s\"\n", (const char *)m_targetapp, (const char *)m_targetmsg); | 3855 | fprintf(f, "msg \"File/SetDictionary(QString)\" \"%s/%s\"\n", (const char *)m_targetapp, (const char *)m_targetmsg); |
3855 | #ifdef _SCROLLPIPE | 3856 | #ifdef _SCROLLPIPE |
3856 | fprintf(f, "msg \"File/SetScrollTarget(QString)\" \"%s\"\n", (const char *)reader->m_pipetarget); | 3857 | fprintf(f, "msg \"File/SetScrollTarget(QString)\" \"%s\"\n", (const char *)reader->m_pipetarget); |
3857 | #endif | 3858 | #endif |
3858 | fprintf(f, "msg \"File/Two/OneTouch(int)\" %d\n", (m_twoTouch) ? 1:0); | 3859 | fprintf(f, "msg \"File/Two/OneTouch(int)\" %d\n", (m_twoTouch) ? 1:0); |
3859 | fprintf(f, "msg \"Target/Annotation(int)\" %d\n", (m_doAnnotation) ? 1:0); | 3860 | fprintf(f, "msg \"Target/Annotation(int)\" %d\n", (m_doAnnotation) ? 1:0); |
3860 | fprintf(f, "msg \"Target/Dictionary(int)\" %d\n", (m_doDictionary) ? 1:0); | 3861 | fprintf(f, "msg \"Target/Dictionary(int)\" %d\n", (m_doDictionary) ? 1:0); |
3861 | fprintf(f, "msg \"Target/Clipboard(int)\" %d\n", (m_doClipboard) ? 1:0); | 3862 | fprintf(f, "msg \"Target/Clipboard(int)\" %d\n", (m_doClipboard) ? 1:0); |
3862 | fprintf(f, "msg \"File/Action(QString)\" \"%s\"\n", (const char *)m_buttonAction[m_spaceTarget]->text()); | 3863 | fprintf(f, "msg \"File/Action(QString)\" \"%s\"\n", (const char *)m_buttonAction[m_spaceTarget]->text()); |
3863 | fprintf(f, "msg \"Update(int)\" 1\n"); | 3864 | fprintf(f, "msg \"Update(int)\" 1\n"); |
3864 | fprintf(f, "msg \"info(QString)\" \"All Done\"\n"); | 3865 | fprintf(f, "msg \"info(QString)\" \"All Done\"\n"); |
3865 | fclose(f); | 3866 | fclose(f); |
3866 | chmod(sname, S_IXUSR | S_IXGRP | S_IXOTH); | 3867 | chmod(sname, S_IXUSR | S_IXGRP | S_IXOTH); |
3867 | } | 3868 | } |
3868 | } | 3869 | } |
3869 | 3870 | ||
@@ -3913,67 +3914,67 @@ bool QTReaderApp::readconfig(const QString& _txt, bool full=false) | |||
3913 | 3914 | ||
3914 | if (full) | 3915 | if (full) |
3915 | { | 3916 | { |
3916 | configname = _txt; | 3917 | configname = _txt; |
3917 | dom = Config::User; | 3918 | dom = Config::User; |
3918 | } | 3919 | } |
3919 | else | 3920 | else |
3920 | { | 3921 | { |
3921 | configname = Global::applicationFileName(APPDIR "/configs", _txt); | 3922 | configname = Global::applicationFileName(APPDIR "/configs", _txt); |
3922 | QFileInfo fm(configname); | 3923 | QFileInfo fm(configname); |
3923 | if ( !fm.exists() ) return false; | 3924 | if ( !fm.exists() ) return false; |
3924 | dom = Config::File; | 3925 | dom = Config::File; |
3925 | } | 3926 | } |
3926 | 3927 | ||
3927 | Config config(configname, dom); | 3928 | Config config(configname, dom); |
3928 | config.setGroup( "View" ); | 3929 | config.setGroup( "View" ); |
3929 | 3930 | ||
3930 | #else | 3931 | #else |
3931 | QFileInfo fi; | 3932 | QFileInfo fi; |
3932 | if (full) | 3933 | if (full) |
3933 | { | 3934 | { |
3934 | QDir d = QDir::home(); // "/" | 3935 | QDir d = QDir::home(); // "/" |
3935 | if ( !d.cd(_txt) ) | 3936 | if ( !d.cd(_txt) ) |
3936 | { // "/tmp" | 3937 | { // "/tmp" |
3937 | qWarning( "Cannot find the \"~/%s\" directory", (const char*)_txt ); | 3938 | owarn << "Cannot find the \"~/" << _txt << "\" directory" << oendl; |
3938 | d = QDir::home(); | 3939 | d = QDir::home(); |
3939 | d.mkdir(_txt); | 3940 | d.mkdir(_txt); |
3940 | d.cd(_txt); | 3941 | d.cd(_txt); |
3941 | } | 3942 | } |
3942 | fi.setFile(d, INIFILE); | 3943 | fi.setFile(d, INIFILE); |
3943 | } | 3944 | } |
3944 | else | 3945 | else |
3945 | { | 3946 | { |
3946 | QDir d = QDir::home(); // "/" | 3947 | QDir d = QDir::home(); // "/" |
3947 | if ( !d.cd(APPDIR) ) | 3948 | if ( !d.cd(APPDIR) ) |
3948 | { // "/tmp" | 3949 | { // "/tmp" |
3949 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 3950 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; |
3950 | d = QDir::home(); | 3951 | d = QDir::home(); |
3951 | d.mkdir(APPDIR); | 3952 | d.mkdir(APPDIR); |
3952 | d.cd(APPDIR); | 3953 | d.cd(APPDIR); |
3953 | } | 3954 | } |
3954 | if ( !d.cd("configs") ) | 3955 | if ( !d.cd("configs") ) |
3955 | { // "/tmp" | 3956 | { // "/tmp" |
3956 | qWarning( "Cannot find the \"~/" APPDIR "/configs\" directory" ); | 3957 | owarn << "Cannot find the \"~/" APPDIR "/configs\" directory" << oendl; |
3957 | d = QDir::home(); | 3958 | d = QDir::home(); |
3958 | d.mkdir("configs"); | 3959 | d.mkdir("configs"); |
3959 | d.cd("configs"); | 3960 | d.cd("configs"); |
3960 | } | 3961 | } |
3961 | fi.setFile(d, _txt); | 3962 | fi.setFile(d, _txt); |
3962 | } | 3963 | } |
3963 | #ifdef _WINDOWS | 3964 | #ifdef _WINDOWS |
3964 | struct stat fnstat; | 3965 | struct stat fnstat; |
3965 | if (stat((const char *)reader->m_lastfile, &fnstat) == 0) return false; // get round fileinfo bug on windows | 3966 | if (stat((const char *)reader->m_lastfile, &fnstat) == 0) return false; // get round fileinfo bug on windows |
3966 | #else | 3967 | #else |
3967 | if (!fi.exists()) return false; | 3968 | if (!fi.exists()) return false; |
3968 | #endif | 3969 | #endif |
3969 | Config config(fi.absFilePath()); | 3970 | Config config(fi.absFilePath()); |
3970 | #endif | 3971 | #endif |
3971 | if (full) | 3972 | if (full) |
3972 | { | 3973 | { |
3973 | config.setGroup("Toolbar"); | 3974 | config.setGroup("Toolbar"); |
3974 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false); | 3975 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false); |
3975 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1); | 3976 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1); |
3976 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2); | 3977 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2); |
3977 | } | 3978 | } |
3978 | config.setGroup( "View" ); | 3979 | config.setGroup( "View" ); |
3979 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); | 3980 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); |
@@ -3997,8 +3998,8 @@ bool QTReaderApp::readconfig(const QString& _txt, bool full=false) | |||
3997 | reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); | 3998 | reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); |
3998 | if (full) | 3999 | if (full) |
3999 | { | 4000 | { |
4000 | reader->m_lastfile = config.readEntry( "LastFile", QString::null ); | 4001 | reader->m_lastfile = config.readEntry( "LastFile", QString::null ); |
4001 | reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); | 4002 | reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); |
4002 | } | 4003 | } |
4003 | reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); | 4004 | reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); |
4004 | reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false); | 4005 | reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false); |
@@ -4045,7 +4046,7 @@ bool QTReaderApp::readconfig(const QString& _txt, bool full=false) | |||
4045 | setfontHelper(reader->m_fontname); | 4046 | setfontHelper(reader->m_fontname); |
4046 | if (full) | 4047 | if (full) |
4047 | { | 4048 | { |
4048 | addtoolbars(&config); | 4049 | addtoolbars(&config); |
4049 | } | 4050 | } |
4050 | reader->setfilter(reader->getfilter()); | 4051 | reader->setfilter(reader->getfilter()); |
4051 | reader->refresh(); | 4052 | reader->refresh(); |
@@ -4061,16 +4062,16 @@ bool QTReaderApp::PopulateConfig(const char* tgtdir) | |||
4061 | 4062 | ||
4062 | QDir d = QDir::home(); // "/" | 4063 | QDir d = QDir::home(); // "/" |
4063 | if ( !d.cd(APPDIR) ) { // "/tmp" | 4064 | if ( !d.cd(APPDIR) ) { // "/tmp" |
4064 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 4065 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; |
4065 | d = QDir::home(); | 4066 | d = QDir::home(); |
4066 | d.mkdir(APPDIR); | 4067 | d.mkdir(APPDIR); |
4067 | d.cd(APPDIR); | 4068 | d.cd(APPDIR); |
4068 | } | 4069 | } |
4069 | if ( !d.cd(tgtdir) ) { // "/tmp" | 4070 | if ( !d.cd(tgtdir) ) { // "/tmp" |
4070 | qWarning( "Cannot find the \"~/" APPDIR "/%s\" directory", tgtdir ); | 4071 | owarn << "Cannot find the \"~/" APPDIR "/" << tgtdir << "\" directory" << oendl; |
4071 | d = QDir::home(); | 4072 | d = QDir::home(); |
4072 | d.mkdir(tgtdir); | 4073 | d.mkdir(tgtdir); |
4073 | d.cd(tgtdir); | 4074 | d.cd(tgtdir); |
4074 | } | 4075 | } |
4075 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 4076 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
4076 | // d.setSorting( QDir::Size | QDir::Reversed ); | 4077 | // d.setSorting( QDir::Size | QDir::Reversed ); |
@@ -4080,14 +4081,14 @@ bool QTReaderApp::PopulateConfig(const char* tgtdir) | |||
4080 | QFileInfo *fi; // pointer for traversing | 4081 | QFileInfo *fi; // pointer for traversing |
4081 | 4082 | ||
4082 | while ( (fi=it.current()) ) { // for each file... | 4083 | while ( (fi=it.current()) ) { // for each file... |
4083 | 4084 | ||
4084 | bkmkselector->insertItem(fi->fileName()); | 4085 | bkmkselector->insertItem(fi->fileName()); |
4085 | cnt++; | 4086 | cnt++; |
4086 | 4087 | ||
4087 | //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); | 4088 | //odebug << "" << fi->size() << " " << fi->fileName().data() << "" << oendl; |
4088 | ++it; // goto next list element | 4089 | ++it; // goto next list element |
4089 | } | 4090 | } |
4090 | 4091 | ||
4091 | #else /* USEQPE */ | 4092 | #else /* USEQPE */ |
4092 | int cnt = 0; | 4093 | int cnt = 0; |
4093 | DIR *d; | 4094 | DIR *d; |
@@ -4100,16 +4101,16 @@ bool QTReaderApp::PopulateConfig(const char* tgtdir) | |||
4100 | 4101 | ||
4101 | while(1) | 4102 | while(1) |
4102 | { | 4103 | { |
4103 | struct dirent* de; | 4104 | struct dirent* de; |
4104 | struct stat buf; | 4105 | struct stat buf; |
4105 | de = readdir(d); | 4106 | de = readdir(d); |
4106 | if (de == NULL) break; | 4107 | if (de == NULL) break; |
4107 | 4108 | ||
4108 | if (lstat((const char *)Global::applicationFileName(finaldir,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) | 4109 | if (lstat((const char *)Global::applicationFileName(finaldir,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) |
4109 | { | 4110 | { |
4110 | bkmkselector->insertItem(de->d_name); | 4111 | bkmkselector->insertItem(de->d_name); |
4111 | cnt++; | 4112 | cnt++; |
4112 | } | 4113 | } |
4113 | } | 4114 | } |
4114 | delete [] finaldir; | 4115 | delete [] finaldir; |
4115 | closedir(d); | 4116 | closedir(d); |
@@ -4123,7 +4124,7 @@ void QTReaderApp::LoadConfig() | |||
4123 | { | 4124 | { |
4124 | editorStack->raiseWidget( bkmkselector ); | 4125 | editorStack->raiseWidget( bkmkselector ); |
4125 | hidetoolbars(); | 4126 | hidetoolbars(); |
4126 | m_nBkmkAction = cLdConfig; | 4127 | m_nBkmkAction = cLdConfig; |
4127 | } | 4128 | } |
4128 | else | 4129 | else |
4129 | QMessageBox::information(this, PROGNAME, "No config files"); | 4130 | QMessageBox::information(this, PROGNAME, "No config files"); |
@@ -4135,7 +4136,7 @@ void QTReaderApp::TidyConfig() | |||
4135 | { | 4136 | { |
4136 | editorStack->raiseWidget( bkmkselector ); | 4137 | editorStack->raiseWidget( bkmkselector ); |
4137 | hidetoolbars(); | 4138 | hidetoolbars(); |
4138 | m_nBkmkAction = cRmConfig; | 4139 | m_nBkmkAction = cRmConfig; |
4139 | } | 4140 | } |
4140 | else | 4141 | else |
4141 | QMessageBox::information(this, PROGNAME, "No config files"); | 4142 | QMessageBox::information(this, PROGNAME, "No config files"); |
@@ -4147,7 +4148,7 @@ void QTReaderApp::ExportLinks() | |||
4147 | { | 4148 | { |
4148 | editorStack->raiseWidget( bkmkselector ); | 4149 | editorStack->raiseWidget( bkmkselector ); |
4149 | hidetoolbars(); | 4150 | hidetoolbars(); |
4150 | m_nBkmkAction = cExportLinks; | 4151 | m_nBkmkAction = cExportLinks; |
4151 | } | 4152 | } |
4152 | else | 4153 | else |
4153 | QMessageBox::information(this, PROGNAME, "No url files"); | 4154 | QMessageBox::information(this, PROGNAME, "No url files"); |
@@ -4161,23 +4162,23 @@ void QTReaderApp::OnURLSelected(const QString& href) | |||
4161 | urld->globalfile(m_url_globalfile); | 4162 | urld->globalfile(m_url_globalfile); |
4162 | if (urld->exec()) | 4163 | if (urld->exec()) |
4163 | { | 4164 | { |
4164 | m_url_clipboard = urld->clipboard(); | 4165 | m_url_clipboard = urld->clipboard(); |
4165 | m_url_localfile = urld->localfile(); | 4166 | m_url_localfile = urld->localfile(); |
4166 | m_url_globalfile = urld->globalfile(); | 4167 | m_url_globalfile = urld->globalfile(); |
4167 | if (m_url_clipboard) | 4168 | if (m_url_clipboard) |
4168 | { | 4169 | { |
4169 | QClipboard* cb = QApplication::clipboard(); | 4170 | QClipboard* cb = QApplication::clipboard(); |
4170 | cb->setText(href); | 4171 | cb->setText(href); |
4171 | qDebug("<a href=\"%s\">%s</a>", (const char*)href, (const char*)href); | 4172 | odebug << "<a href=\"" << href << "\">" << href << "</a>" << oendl; |
4172 | } | 4173 | } |
4173 | if (m_url_localfile) | 4174 | if (m_url_localfile) |
4174 | { | 4175 | { |
4175 | writeUrl(reader->m_string, href); | 4176 | writeUrl(reader->m_string, href); |
4176 | } | 4177 | } |
4177 | if (m_url_globalfile) | 4178 | if (m_url_globalfile) |
4178 | { | 4179 | { |
4179 | writeUrl("GlobalURLFile", href); | 4180 | writeUrl("GlobalURLFile", href); |
4180 | } | 4181 | } |
4181 | } | 4182 | } |
4182 | delete urld; | 4183 | delete urld; |
4183 | } | 4184 | } |
@@ -4192,18 +4193,18 @@ void QTReaderApp::writeUrl(const QString& file, const QString& href) | |||
4192 | QDir d = QDir::home(); // "/" | 4193 | QDir d = QDir::home(); // "/" |
4193 | if ( !d.cd(APPDIR) ) | 4194 | if ( !d.cd(APPDIR) ) |
4194 | { // "/tmp" | 4195 | { // "/tmp" |
4195 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 4196 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; |
4196 | d = QDir::home(); | 4197 | d = QDir::home(); |
4197 | d.mkdir(APPDIR); | 4198 | d.mkdir(APPDIR); |
4198 | d.cd(APPDIR); | 4199 | d.cd(APPDIR); |
4199 | } | 4200 | } |
4200 | if ( !d.cd("urls") ) | 4201 | if ( !d.cd("urls") ) |
4201 | { // "/tmp" | 4202 | { // "/tmp" |
4202 | qWarning( "Cannot find the \"~/" APPDIR "/urls\" directory" ); | 4203 | owarn << "Cannot find the \"~/" APPDIR "/urls\" directory" << oendl; |
4203 | d = QDir::home(); | 4204 | d = QDir::home(); |
4204 | d.cd(APPDIR); | 4205 | d.cd(APPDIR); |
4205 | d.mkdir("urls"); | 4206 | d.mkdir("urls"); |
4206 | d.cd("urls"); | 4207 | d.cd("urls"); |
4207 | } | 4208 | } |
4208 | fi.setFile(d, file); | 4209 | fi.setFile(d, file); |
4209 | filename = fi.absFilePath(); | 4210 | filename = fi.absFilePath(); |
@@ -4211,11 +4212,11 @@ void QTReaderApp::writeUrl(const QString& file, const QString& href) | |||
4211 | FILE* fout = fopen(filename, "a"); | 4212 | FILE* fout = fopen(filename, "a"); |
4212 | if (fout != NULL) | 4213 | if (fout != NULL) |
4213 | { | 4214 | { |
4214 | fprintf(fout, "<p><a href=\"%s\">%s</a>\n", (const char*)href, (const char*)href); | 4215 | fprintf(fout, "<p><a href=\"%s\">%s</a>\n", (const char*)href, (const char*)href); |
4215 | fclose(fout); | 4216 | fclose(fout); |
4216 | } | 4217 | } |
4217 | else | 4218 | else |
4218 | { | 4219 | { |
4219 | QMessageBox::warning(this, PROGNAME, "Problem with writing URL"); | 4220 | QMessageBox::warning(this, PROGNAME, "Problem with writing URL"); |
4220 | } | 4221 | } |
4221 | } | 4222 | } |
diff --git a/noncore/apps/opie-reader/StyleConsts.cpp b/noncore/apps/opie-reader/StyleConsts.cpp index 9fb56b7..f47acee 100644 --- a/noncore/apps/opie-reader/StyleConsts.cpp +++ b/noncore/apps/opie-reader/StyleConsts.cpp | |||
@@ -6,7 +6,7 @@ GraphicLink::~GraphicLink() { delete graphic; } | |||
6 | 6 | ||
7 | pmstore::~pmstore() | 7 | pmstore::~pmstore() |
8 | { | 8 | { |
9 | //// qDebug("Deleting image"); | 9 | //// odebug << "Deleting image" << oendl; |
10 | delete graphic; | 10 | delete graphic; |
11 | } | 11 | } |
12 | 12 | ||
diff --git a/noncore/apps/opie-reader/fileBrowser.cpp b/noncore/apps/opie-reader/fileBrowser.cpp index e1cde6c..72a1222 100644 --- a/noncore/apps/opie-reader/fileBrowser.cpp +++ b/noncore/apps/opie-reader/fileBrowser.cpp | |||
@@ -132,7 +132,7 @@ fileBrowser::~fileBrowser() | |||
132 | void fileBrowser::populateList() | 132 | void fileBrowser::populateList() |
133 | { | 133 | { |
134 | ListView->clear(); | 134 | ListView->clear(); |
135 | ////qDebug(currentDir.canonicalPath()); | 135 | ////odebug << currentDir.canonicalPath() << oendl; |
136 | // currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks ); | 136 | // currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks ); |
137 | currentDir.setFilter( filterspec ); | 137 | currentDir.setFilter( filterspec ); |
138 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 138 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
@@ -156,7 +156,7 @@ void fileBrowser::populateList() | |||
156 | } | 156 | } |
157 | else | 157 | else |
158 | { | 158 | { |
159 | //// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 159 | //// odebug << "Not a dir: "+currentDir.canonicalPath()+fileL << oendl; |
160 | } | 160 | } |
161 | new QListViewItem( ListView,fileL,fileS ); | 161 | new QListViewItem( ListView,fileL,fileS ); |
162 | } | 162 | } |
@@ -169,7 +169,7 @@ void fileBrowser::populateList() | |||
169 | 169 | ||
170 | void fileBrowser::upDir() | 170 | void fileBrowser::upDir() |
171 | { | 171 | { |
172 | //// qDebug(currentDir.canonicalPath()); | 172 | //// odebug << currentDir.canonicalPath() << oendl; |
173 | } | 173 | } |
174 | 174 | ||
175 | void fileBrowser::listClicked(QListViewItem *selectedItem) | 175 | void fileBrowser::listClicked(QListViewItem *selectedItem) |
@@ -177,7 +177,7 @@ void fileBrowser::listClicked(QListViewItem *selectedItem) | |||
177 | if (selectedItem == NULL) return; | 177 | if (selectedItem == NULL) return; |
178 | QString strItem=selectedItem->text(0); | 178 | QString strItem=selectedItem->text(0); |
179 | 179 | ||
180 | //// qDebug("%s", (const char*)strItem); | 180 | //// odebug << "" << strItem << "" << oendl; |
181 | 181 | ||
182 | 182 | ||
183 | QString strSize=selectedItem->text(1); | 183 | QString strSize=selectedItem->text(1); |
diff --git a/noncore/apps/opie-reader/opie-reader.pro b/noncore/apps/opie-reader/opie-reader.pro index e42204a..dbf6964 100644 --- a/noncore/apps/opie-reader/opie-reader.pro +++ b/noncore/apps/opie-reader/opie-reader.pro | |||
@@ -1,5 +1,5 @@ | |||
1 | CONFIG = qt warn_on | 1 | CONFIG = qt warn_on |
2 | HEADERS = Aportis.h \ | 2 | HEADERS = Aportis.h \ |
3 | Bkmks.h \ | 3 | Bkmks.h \ |
4 | BuffDoc.h \ | 4 | BuffDoc.h \ |
5 | CAnnoEdit.h \ | 5 | CAnnoEdit.h \ |
@@ -49,7 +49,7 @@ HEADERS = Aportis.h \ | |||
49 | version.h \ | 49 | version.h \ |
50 | ztxt.h | 50 | ztxt.h |
51 | 51 | ||
52 | SOURCES = Aportis.cpp \ | 52 | SOURCES = Aportis.cpp \ |
53 | Bkmks.cpp \ | 53 | Bkmks.cpp \ |
54 | BuffDoc.cpp \ | 54 | BuffDoc.cpp \ |
55 | CBuffer.cpp \ | 55 | CBuffer.cpp \ |
@@ -83,9 +83,9 @@ SOURCES = Aportis.cpp \ | |||
83 | DESTDIR = $(OPIEDIR)/bin | 83 | DESTDIR = $(OPIEDIR)/bin |
84 | TARGET = reader | 84 | TARGET = reader |
85 | 85 | ||
86 | INCLUDEPATH+= $(OPIEDIR)/include | 86 | INCLUDEPATH += $(OPIEDIR)/include |
87 | DEPENDPATH+= $(OPIEDIR)/include | 87 | DEPENDPATH += $(OPIEDIR)/include |
88 | LIBS += -lqpe | 88 | LIBS += -lqpe -lopiecore2 |
89 | 89 | ||
90 | include ( $(OPIEDIR)/include.pro ) | 90 | include ( $(OPIEDIR)/include.pro ) |
91 | 91 | ||
diff --git a/noncore/apps/opie-reader/plucker.cpp b/noncore/apps/opie-reader/plucker.cpp index e52fd6a..a8e688f 100644 --- a/noncore/apps/opie-reader/plucker.cpp +++ b/noncore/apps/opie-reader/plucker.cpp | |||
@@ -57,19 +57,19 @@ int CPlucker::bgetch() | |||
57 | { | 57 | { |
58 | if (!m_continuous) return EOF; | 58 | if (!m_continuous) return EOF; |
59 | if (bufferrec >= ntohs(head.recordList.numRecords) - 1) return EOF; | 59 | if (bufferrec >= ntohs(head.recordList.numRecords) - 1) return EOF; |
60 | ////qDebug("Passing through %u", currentpos); | 60 | ////odebug << "Passing through " << currentpos << "" << oendl; |
61 | if (!expand(bufferrec+1)) return EOF; | 61 | if (!expand(bufferrec+1)) return EOF; |
62 | mystyle.unset(); | 62 | mystyle.unset(); |
63 | if (m_ParaOffsets[m_nextParaIndex] == 0) | 63 | if (m_ParaOffsets[m_nextParaIndex] == 0) |
64 | { | 64 | { |
65 | while (m_ParaOffsets[m_nextParaIndex+1] == 0) | 65 | while (m_ParaOffsets[m_nextParaIndex+1] == 0) |
66 | { | 66 | { |
67 | // qDebug("Skipping extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7); | 67 | // odebug << "Skipping extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl; |
68 | m_nextParaIndex++; | 68 | m_nextParaIndex++; |
69 | } | 69 | } |
70 | } | 70 | } |
71 | mystyle.setExtraSpace((m_ParaAttrs[m_nextParaIndex]&7)*2); | 71 | mystyle.setExtraSpace((m_ParaAttrs[m_nextParaIndex]&7)*2); |
72 | //qDebug("Using extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7); | 72 | //odebug << "Using extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl; |
73 | ch = 10; | 73 | ch = 10; |
74 | EOPPhase = 4; | 74 | EOPPhase = 4; |
75 | } | 75 | } |
@@ -79,7 +79,7 @@ int CPlucker::bgetch() | |||
79 | { | 79 | { |
80 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; | 80 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; |
81 | m_nextParaIndex++; | 81 | m_nextParaIndex++; |
82 | // qDebug("Skipping extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7); | 82 | // odebug << "Skipping extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl; |
83 | if (m_nextParaIndex == m_nParas) | 83 | if (m_nextParaIndex == m_nParas) |
84 | { | 84 | { |
85 | m_nextPara = -1; | 85 | m_nextPara = -1; |
@@ -91,7 +91,7 @@ int CPlucker::bgetch() | |||
91 | } | 91 | } |
92 | mystyle.unset(); | 92 | mystyle.unset(); |
93 | mystyle.setExtraSpace((m_ParaAttrs[m_nextParaIndex]&7)*2); | 93 | mystyle.setExtraSpace((m_ParaAttrs[m_nextParaIndex]&7)*2); |
94 | //qDebug("Using extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7); | 94 | //odebug << "Using extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl; |
95 | if (m_lastBreak == locate()) | 95 | if (m_lastBreak == locate()) |
96 | { | 96 | { |
97 | currentpos++; | 97 | currentpos++; |
diff --git a/noncore/apps/opie-reader/plucker_base.cpp b/noncore/apps/opie-reader/plucker_base.cpp index caa945d..b523a54 100644 --- a/noncore/apps/opie-reader/plucker_base.cpp +++ b/noncore/apps/opie-reader/plucker_base.cpp | |||
@@ -1,24 +1,32 @@ | |||
1 | |||
2 | |||
1 | #include "useqpe.h" | 3 | #include "useqpe.h" |
2 | #include <stdio.h> | 4 | #include "plucker_base.h" |
3 | #include <string.h> | 5 | #include "Aportis.h" |
6 | #include "Palm2QImage.h" | ||
7 | |||
8 | /* OPIE */ | ||
9 | #include <opie2/odebug.h> | ||
4 | #ifdef USEQPE | 10 | #ifdef USEQPE |
5 | #include <qpe/qcopenvelope_qws.h> | 11 | #include <qpe/qcopenvelope_qws.h> |
6 | #endif /* USEQPE */ | ||
7 | #ifdef LOCALPICTURES | ||
8 | #include <qscrollview.h> | ||
9 | #endif | ||
10 | #ifdef USEQPE | ||
11 | #include <qpe/global.h> | 12 | #include <qpe/global.h> |
12 | #endif /* USEQPE */ | 13 | #endif /* USEQPE */ |
14 | |||
13 | #ifndef USEQPE | 15 | #ifndef USEQPE |
14 | #include <qapplication.h> | 16 | #include <qapplication.h> |
15 | #else /* USEQPE */ | 17 | #else /* USEQPE */ |
16 | #include <qpe/qpeapplication.h> | 18 | #include <qpe/qpeapplication.h> |
17 | #endif /* USEQPE */ | 19 | #endif /* USEQPE */ |
18 | 20 | ||
19 | #include "plucker_base.h" | 21 | /* QT */ |
20 | #include "Aportis.h" | 22 | #ifdef LOCALPICTURES |
21 | #include "Palm2QImage.h" | 23 | #include <qscrollview.h> |
24 | #endif | ||
25 | |||
26 | /* STD */ | ||
27 | #include <stdio.h> | ||
28 | #include <string.h> | ||
29 | |||
22 | 30 | ||
23 | CPlucker_base::CPlucker_base() : | 31 | CPlucker_base::CPlucker_base() : |
24 | #ifdef LOCALPICTURES | 32 | #ifdef LOCALPICTURES |
@@ -35,36 +43,36 @@ void CPlucker_base::Expand(UInt32 reclen, UInt8 type, UInt8* buffer, UInt32 buff | |||
35 | { | 43 | { |
36 | if (type%2 == 0) | 44 | if (type%2 == 0) |
37 | { | 45 | { |
38 | fread(buffer, reclen, sizeof(char), fin); | 46 | fread(buffer, reclen, sizeof(char), fin); |
39 | } | 47 | } |
40 | else | 48 | else |
41 | { | 49 | { |
42 | UInt8* readbuffer = NULL; | 50 | UInt8* readbuffer = NULL; |
43 | if (reclen > compressedbuffersize) | 51 | if (reclen > compressedbuffersize) |
44 | { | 52 | { |
45 | readbuffer = new UInt8[reclen]; | 53 | readbuffer = new UInt8[reclen]; |
46 | } | 54 | } |
47 | else | 55 | else |
48 | { | 56 | { |
49 | readbuffer = compressedtextbuffer; | 57 | readbuffer = compressedtextbuffer; |
50 | } | 58 | } |
51 | if (readbuffer != NULL) | 59 | if (readbuffer != NULL) |
52 | { | 60 | { |
53 | fread(readbuffer, reclen, sizeof(char), fin); | 61 | fread(readbuffer, reclen, sizeof(char), fin); |
54 | switch (ntohs(hdr0.version)) | 62 | switch (ntohs(hdr0.version)) |
55 | { | 63 | { |
56 | case 2: | 64 | case 2: |
57 | UnZip(readbuffer, reclen, buffer, buffersize); | 65 | UnZip(readbuffer, reclen, buffer, buffersize); |
58 | break; | 66 | break; |
59 | case 1: | 67 | case 1: |
60 | UnDoc(readbuffer, reclen, buffer, buffersize); | 68 | UnDoc(readbuffer, reclen, buffer, buffersize); |
61 | break; | 69 | break; |
62 | } | 70 | } |
63 | if (reclen > compressedbuffersize) | 71 | if (reclen > compressedbuffersize) |
64 | { | 72 | { |
65 | delete [] readbuffer; | 73 | delete [] readbuffer; |
66 | } | 74 | } |
67 | } | 75 | } |
68 | } | 76 | } |
69 | } | 77 | } |
70 | 78 | ||
@@ -73,15 +81,15 @@ void CPlucker_base::sizes(unsigned long& _file, unsigned long& _text) | |||
73 | _file = file_length; | 81 | _file = file_length; |
74 | if (textlength == 0) | 82 | if (textlength == 0) |
75 | { | 83 | { |
76 | for (int recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) | 84 | for (int recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) |
77 | { | 85 | { |
78 | gotorecordnumber(recptr); | 86 | gotorecordnumber(recptr); |
79 | UInt16 thishdr_uid, thishdr_nParagraphs; | 87 | UInt16 thishdr_uid, thishdr_nParagraphs; |
80 | UInt32 thishdr_size; | 88 | UInt32 thishdr_size; |
81 | UInt8 thishdr_type, thishdr_reserved; | 89 | UInt8 thishdr_type, thishdr_reserved; |
82 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 90 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
83 | if (thishdr_type < 2) textlength += thishdr_size; | 91 | if (thishdr_type < 2) textlength += thishdr_size; |
84 | } | 92 | } |
85 | } | 93 | } |
86 | _text = textlength; | 94 | _text = textlength; |
87 | //ntohl(hdr0.size); | 95 | //ntohl(hdr0.size); |
@@ -93,85 +101,85 @@ char* CPlucker_base::geturl(UInt16 tgt) | |||
93 | gotorecordnumber(0); | 101 | gotorecordnumber(0); |
94 | fread(&hdr0, 1, 6, fin); | 102 | fread(&hdr0, 1, 6, fin); |
95 | unsigned int nrecs = ntohs(hdr0.nRecords); | 103 | unsigned int nrecs = ntohs(hdr0.nRecords); |
96 | //qDebug("Version %u, no. recs %u", ntohs(hdr0.version), nrecs); | 104 | //odebug << "Version " << ntohs(hdr0.version) << ", no. recs " << nrecs << "" << oendl; |
97 | UInt16 urlid = 0; | 105 | UInt16 urlid = 0; |
98 | bool urlsfound = false; | 106 | bool urlsfound = false; |
99 | char* urls = NULL; | 107 | char* urls = NULL; |
100 | size_t urlsize = 0; | 108 | size_t urlsize = 0; |
101 | for (unsigned int i = 0; i < nrecs; i++) | 109 | for (unsigned int i = 0; i < nrecs; i++) |
102 | { | 110 | { |
103 | UInt16 id, name; | 111 | UInt16 id, name; |
104 | fread(&name, 1, sizeof(name), fin); | 112 | fread(&name, 1, sizeof(name), fin); |
105 | fread(&id, 1, sizeof(id), fin); | 113 | fread(&id, 1, sizeof(id), fin); |
106 | //qDebug("N:%d, I:%d", ntohs(name), ntohs(id)); | 114 | //odebug << "N:" << ntohs(name) << ", I:" << ntohs(id) << "" << oendl; |
107 | if (ntohs(name) == 2) | 115 | if (ntohs(name) == 2) |
108 | { | 116 | { |
109 | urlsfound = true; | 117 | urlsfound = true; |
110 | urlid = id; | 118 | urlid = id; |
111 | //qDebug("Found url index:%d", ntohs(urlid)); | 119 | //odebug << "Found url index:" << ntohs(urlid) << "" << oendl; |
112 | } | 120 | } |
113 | ////qDebug("%x", id); | 121 | // //odebug << "" << id << "" << oendl; |
114 | } | 122 | } |
115 | if (urlsfound) | 123 | if (urlsfound) |
116 | { | 124 | { |
117 | unsigned short recptr = finduid(ntohs(urlid)); | 125 | unsigned short recptr = finduid(ntohs(urlid)); |
118 | if (recptr != 0) | 126 | if (recptr != 0) |
119 | { | 127 | { |
120 | gotorecordnumber(recptr); | 128 | gotorecordnumber(recptr); |
121 | UInt16 thishdr_uid, thishdr_nParagraphs; | 129 | UInt16 thishdr_uid, thishdr_nParagraphs; |
122 | UInt32 thishdr_size; | 130 | UInt32 thishdr_size; |
123 | UInt8 thishdr_type, thishdr_reserved; | 131 | UInt8 thishdr_type, thishdr_reserved; |
124 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 132 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
125 | UInt16 urlctr = 0; | 133 | UInt16 urlctr = 0; |
126 | while (1) | 134 | while (1) |
127 | { | 135 | { |
128 | UInt16 tctr; | 136 | UInt16 tctr; |
129 | fread(&tctr, 1, sizeof(tctr), fin); | 137 | fread(&tctr, 1, sizeof(tctr), fin); |
130 | fread(&urlid, 1, sizeof(urlid), fin); | 138 | fread(&urlid, 1, sizeof(urlid), fin); |
131 | tctr = ntohs(tctr); | 139 | tctr = ntohs(tctr); |
132 | //qDebug("tgt:%u urlctr:%u tctr:%u", tgt, urlctr, tctr); | 140 | //odebug << "tgt:" << tgt << " urlctr:" << urlctr << " tctr:" << tctr << "" << oendl; |
133 | if (tctr >= tgt) | 141 | if (tctr >= tgt) |
134 | { | 142 | { |
135 | break; | 143 | break; |
136 | } | 144 | } |
137 | urlctr = tctr; | 145 | urlctr = tctr; |
138 | } | 146 | } |
139 | //qDebug("urls are in %d", ntohs(urlid)); | 147 | //odebug << "urls are in " << ntohs(urlid) << "" << oendl; |
140 | recptr = finduid(ntohs(urlid)); | 148 | recptr = finduid(ntohs(urlid)); |
141 | if (recptr != 0) | 149 | if (recptr != 0) |
142 | { | 150 | { |
143 | UInt32 reclen = recordlength(recptr) - HeaderSize(); | 151 | UInt32 reclen = recordlength(recptr) - HeaderSize(); |
144 | gotorecordnumber(recptr); | 152 | gotorecordnumber(recptr); |
145 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 153 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
146 | //qDebug("Found urls:%x",thishdr_type); | 154 | //odebug << "Found urls:" << thishdr_type << "" << oendl; |
147 | urlsize = thishdr_size; | 155 | urlsize = thishdr_size; |
148 | urls = new char[urlsize]; | 156 | urls = new char[urlsize]; |
149 | Expand(reclen, thishdr_type, (UInt8*)urls, urlsize); | 157 | Expand(reclen, thishdr_type, (UInt8*)urls, urlsize); |
150 | char* ptr = urls; | 158 | char* ptr = urls; |
151 | int rn = urlctr+1; | 159 | int rn = urlctr+1; |
152 | while (ptr - urls < urlsize) | 160 | while (ptr - urls < urlsize) |
153 | { | 161 | { |
154 | if (rn == tgt) | 162 | if (rn == tgt) |
155 | { | 163 | { |
156 | //qDebug("URL:%s", ptr); | 164 | //odebug << "URL:" << ptr << "" << oendl; |
157 | int len = strlen(ptr)+1; | 165 | int len = strlen(ptr)+1; |
158 | pRet = new char[len]; | 166 | pRet = new char[len]; |
159 | memcpy(pRet, ptr, len); | 167 | memcpy(pRet, ptr, len); |
160 | break; | 168 | break; |
161 | } | 169 | } |
162 | ptr += strlen(ptr)+1; | 170 | ptr += strlen(ptr)+1; |
163 | rn++; | 171 | rn++; |
164 | } | 172 | } |
165 | delete [] urls; | 173 | delete [] urls; |
166 | } | 174 | } |
167 | } | 175 | } |
168 | } | 176 | } |
169 | else | 177 | else |
170 | { | 178 | { |
171 | QMessageBox::information(NULL, | 179 | QMessageBox::information(NULL, |
172 | QString(PROGNAME), | 180 | QString(PROGNAME), |
173 | QString("No external links\nin this pluck") | 181 | QString("No external links\nin this pluck") |
174 | ); | 182 | ); |
175 | } | 183 | } |
176 | return pRet; | 184 | return pRet; |
177 | } | 185 | } |
@@ -206,9 +214,9 @@ unsigned int CPlucker_base::locate() | |||
206 | while (thisrec < bufferrec) | 214 | while (thisrec < bufferrec) |
207 | { | 215 | { |
208 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 216 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
209 | if (thishdr_type < 2) locpos += thishdr_size; | 217 | if (thishdr_type < 2) locpos += thishdr_size; |
210 | thisrec++; | 218 | thisrec++; |
211 | gotorecordnumber(thisrec); | 219 | gotorecordnumber(thisrec); |
212 | } | 220 | } |
213 | return locpos+bufferpos; | 221 | return locpos+bufferpos; |
214 | */ | 222 | */ |
@@ -222,60 +230,60 @@ void CPlucker_base::locate(unsigned int n) | |||
222 | UInt16 recptr = bufferrec; | 230 | UInt16 recptr = bufferrec; |
223 | if (n < textlength/2) | 231 | if (n < textlength/2) |
224 | { | 232 | { |
225 | textlength = 0; | 233 | textlength = 0; |
226 | UInt16 thishdr_uid, thishdr_nParagraphs; | 234 | UInt16 thishdr_uid, thishdr_nParagraphs; |
227 | UInt32 thishdr_size = buffercontent; | 235 | UInt32 thishdr_size = buffercontent; |
228 | UInt8 thishdr_type, thishdr_reserved; | 236 | UInt8 thishdr_type, thishdr_reserved; |
229 | for (recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) | 237 | for (recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) |
230 | { | 238 | { |
231 | gotorecordnumber(recptr); | 239 | gotorecordnumber(recptr); |
232 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 240 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
233 | if (thishdr_type < 2) | 241 | if (thishdr_type < 2) |
234 | { | 242 | { |
235 | textlength += thishdr_size; | 243 | textlength += thishdr_size; |
236 | if (textlength > n) | 244 | if (textlength > n) |
237 | { | 245 | { |
238 | textlength -= thishdr_size; | 246 | textlength -= thishdr_size; |
239 | break; | 247 | break; |
240 | } | 248 | } |
241 | } | 249 | } |
242 | } | 250 | } |
243 | } | 251 | } |
244 | else if (n < textlength) | 252 | else if (n < textlength) |
245 | { | 253 | { |
246 | UInt16 thishdr_uid, thishdr_nParagraphs; | 254 | UInt16 thishdr_uid, thishdr_nParagraphs; |
247 | UInt32 thishdr_size; | 255 | UInt32 thishdr_size; |
248 | UInt8 thishdr_type, thishdr_reserved; | 256 | UInt8 thishdr_type, thishdr_reserved; |
249 | while (n < textlength && recptr > 1) | 257 | while (n < textlength && recptr > 1) |
250 | { | 258 | { |
251 | recptr--; | 259 | recptr--; |
252 | gotorecordnumber(recptr); | 260 | gotorecordnumber(recptr); |
253 | //qDebug("recptr:%u", recptr); | 261 | //odebug << "recptr:" << recptr << "" << oendl; |
254 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 262 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
255 | if (thishdr_type < 2) | 263 | if (thishdr_type < 2) |
256 | { | 264 | { |
257 | textlength -= thishdr_size; | 265 | textlength -= thishdr_size; |
258 | } | 266 | } |
259 | } | 267 | } |
260 | } | 268 | } |
261 | else | 269 | else |
262 | { | 270 | { |
263 | UInt16 thishdr_uid, thishdr_nParagraphs; | 271 | UInt16 thishdr_uid, thishdr_nParagraphs; |
264 | UInt32 thishdr_size = buffercontent; | 272 | UInt32 thishdr_size = buffercontent; |
265 | UInt8 thishdr_type, thishdr_reserved; | 273 | UInt8 thishdr_type, thishdr_reserved; |
266 | while (n > textlength + thishdr_size && recptr < ntohs(head.recordList.numRecords)-1) | 274 | while (n > textlength + thishdr_size && recptr < ntohs(head.recordList.numRecords)-1) |
267 | { | 275 | { |
268 | textlength += thishdr_size; | 276 | textlength += thishdr_size; |
269 | recptr++; | 277 | recptr++; |
270 | gotorecordnumber(recptr); | 278 | gotorecordnumber(recptr); |
271 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 279 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
272 | if (!(thishdr_type < 2)) | 280 | if (!(thishdr_type < 2)) |
273 | { | 281 | { |
274 | thishdr_size = 0; | 282 | thishdr_size = 0; |
275 | } | 283 | } |
276 | } | 284 | } |
277 | } | 285 | } |
278 | // qDebug("Time(1): %u", clock()-start); | 286 | // odebug << "Time(1): " << clock()-start << "" << oendl; |
279 | /* | 287 | /* |
280 | expand(recptr); | 288 | expand(recptr); |
281 | mystyle.unset(); | 289 | mystyle.unset(); |
@@ -283,16 +291,16 @@ void CPlucker_base::locate(unsigned int n) | |||
283 | currentpos = n; | 291 | currentpos = n; |
284 | while (bufferpos >= m_nextPara && m_nextPara >= 0) | 292 | while (bufferpos >= m_nextPara && m_nextPara >= 0) |
285 | { | 293 | { |
286 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; | 294 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; |
287 | m_nextParaIndex++; | 295 | m_nextParaIndex++; |
288 | if (m_nextParaIndex == m_nParas) | 296 | if (m_nextParaIndex == m_nParas) |
289 | { | 297 | { |
290 | m_nextPara = -1; | 298 | m_nextPara = -1; |
291 | } | 299 | } |
292 | else | 300 | else |
293 | { | 301 | { |
294 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; | 302 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; |
295 | } | 303 | } |
296 | } | 304 | } |
297 | 305 | ||
298 | return; | 306 | return; |
@@ -307,34 +315,34 @@ void CPlucker_base::locate(unsigned int n) | |||
307 | UInt8 thishdr_type, thishdr_reserved; | 315 | UInt8 thishdr_type, thishdr_reserved; |
308 | do | 316 | do |
309 | { | 317 | { |
310 | thisrec++; | 318 | thisrec++; |
311 | locpos += bs; | 319 | locpos += bs; |
312 | gotorecordnumber(thisrec); | 320 | gotorecordnumber(thisrec); |
313 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 321 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
314 | if (thishdr_type < 2) | 322 | if (thishdr_type < 2) |
315 | { | 323 | { |
316 | bs = thishdr_size; | 324 | bs = thishdr_size; |
317 | } | 325 | } |
318 | else | 326 | else |
319 | { | 327 | { |
320 | bs = 0; | 328 | bs = 0; |
321 | } | 329 | } |
322 | } while (locpos + bs <= n); | 330 | } while (locpos + bs <= n); |
323 | 331 | ||
324 | // qDebug("Time(2): %u", clock()-start); | 332 | // odebug << "Time(2): " << clock()-start << "" << oendl; |
325 | if (recptr != thisrec) | 333 | if (recptr != thisrec) |
326 | { | 334 | { |
327 | qDebug("Disaster:recptr:%u thisrec:%u", recptr, thisrec); | 335 | odebug << "Disaster:recptr:" << recptr << " thisrec:" << thisrec << "" << oendl; |
328 | UInt16 thishdr_uid, thishdr_nParagraphs; | 336 | UInt16 thishdr_uid, thishdr_nParagraphs; |
329 | UInt32 thishdr_size = buffercontent; | 337 | UInt32 thishdr_size = buffercontent; |
330 | UInt8 thishdr_type, thishdr_reserved; | 338 | UInt8 thishdr_type, thishdr_reserved; |
331 | for (recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) | 339 | for (recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) |
332 | { | 340 | { |
333 | gotorecordnumber(recptr); | 341 | gotorecordnumber(recptr); |
334 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 342 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
335 | // qDebug("UID:%u Paras:%u Size:%u Type:%u Reserved:%u", thishdr_uid, thishdr_nParagraphs, thishdr_size, (unsigned int)thishdr_type, (unsigned int)thishdr_reserved); | 343 | // odebug << "UID:" << thishdr_uid << " Paras:" << thishdr_nParagraphs << " Size:" << thishdr_size << " Type:" << (unsigned int)thishdr_type << " Reserved:" << (unsigned int)thishdr_reserved << "" << oendl; |
336 | } | 344 | } |
337 | //QApplication::exit ( 100 ); | 345 | // QApplication::exit ( 100 ); |
338 | } | 346 | } |
339 | 347 | ||
340 | currentpos = locpos; | 348 | currentpos = locpos; |
@@ -346,16 +354,16 @@ void CPlucker_base::locate(unsigned int n) | |||
346 | currentpos = n; | 354 | currentpos = n; |
347 | while (bufferpos >= m_nextPara && m_nextPara >= 0) | 355 | while (bufferpos >= m_nextPara && m_nextPara >= 0) |
348 | { | 356 | { |
349 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; | 357 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; |
350 | m_nextParaIndex++; | 358 | m_nextParaIndex++; |
351 | if (m_nextParaIndex == m_nParas) | 359 | if (m_nextParaIndex == m_nParas) |
352 | { | 360 | { |
353 | m_nextPara = -1; | 361 | m_nextPara = -1; |
354 | } | 362 | } |
355 | else | 363 | else |
356 | { | 364 | { |
357 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; | 365 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; |
358 | } | 366 | } |
359 | } | 367 | } |
360 | */ | 368 | */ |
361 | } | 369 | } |
@@ -370,38 +378,38 @@ bool CPlucker_base::expand(int thisrec) | |||
370 | UInt8 thishdr_type, thishdr_reserved; | 378 | UInt8 thishdr_type, thishdr_reserved; |
371 | while (1) | 379 | while (1) |
372 | { | 380 | { |
373 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 381 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
374 | //qDebug("This (%d) type is %d, uid is %u", thisrec, thishdr_type, thishdr_uid); | 382 | //odebug << "This (" << thisrec << ") type is " << thishdr_type << ", uid is " << thishdr_uid << "" << oendl; |
375 | if (thishdr_type < 2) break; | 383 | if (thishdr_type < 2) break; |
376 | //qDebug("Skipping paragraph of type %d", thishdr_type); | 384 | //odebug << "Skipping paragraph of type " << thishdr_type << "" << oendl; |
377 | if (++thisrec >= ntohs(head.recordList.numRecords) - 1) return false; | 385 | if (++thisrec >= ntohs(head.recordList.numRecords) - 1) return false; |
378 | reclen = recordlength(thisrec); | 386 | reclen = recordlength(thisrec); |
379 | gotorecordnumber(thisrec); | 387 | gotorecordnumber(thisrec); |
380 | } | 388 | } |
381 | m_nParas = thishdr_nParagraphs; | 389 | m_nParas = thishdr_nParagraphs; |
382 | m_bufferisreserved = (thishdr_reserved != 0); | 390 | m_bufferisreserved = (thishdr_reserved != 0); |
383 | //qDebug("It has %u paragraphs and is %u bytes", thishdr_nParagraphs, thishdr_size); | 391 | //odebug << "It has " << thishdr_nParagraphs << " paragraphs and is " << thishdr_size << " bytes" << oendl; |
384 | uid = thishdr_uid; | 392 | uid = thishdr_uid; |
385 | // gotorecordnumber(thisrec); | 393 | // gotorecordnumber(thisrec); |
386 | // fread(expandedtextbuffer,1,10,fin); | 394 | // fread(expandedtextbuffer,1,10,fin); |
387 | for (int i = 0; i < m_nParas; i++) | 395 | for (int i = 0; i < m_nParas; i++) |
388 | { | 396 | { |
389 | UInt16 ubytes, attrs; | 397 | UInt16 ubytes, attrs; |
390 | fread(&ubytes, 1, sizeof(ubytes), fin); | 398 | fread(&ubytes, 1, sizeof(ubytes), fin); |
391 | fread(&attrs, 1, sizeof(attrs), fin); | 399 | fread(&attrs, 1, sizeof(attrs), fin); |
392 | m_ParaOffsets[i] = ntohs(ubytes); | 400 | m_ParaOffsets[i] = ntohs(ubytes); |
393 | m_ParaAttrs[i] = ntohs(attrs); | 401 | m_ParaAttrs[i] = ntohs(attrs); |
394 | ////qDebug("Bytes %u, Attr %x", ntohs(ubytes), ntohs(attrs)); | 402 | // //odebug << "Bytes " << ntohs(ubytes) << ", Attr " << ntohs(attrs) << "" << oendl; |
395 | } | 403 | } |
396 | if (m_nParas > 0) | 404 | if (m_nParas > 0) |
397 | { | 405 | { |
398 | m_nextPara = m_ParaOffsets[0]; | 406 | m_nextPara = m_ParaOffsets[0]; |
399 | //qDebug("First offset = %u", m_nextPara); | 407 | //odebug << "First offset = " << m_nextPara << "" << oendl; |
400 | m_nextParaIndex = 0; | 408 | m_nextParaIndex = 0; |
401 | } | 409 | } |
402 | else | 410 | else |
403 | { | 411 | { |
404 | m_nextPara = -1; | 412 | m_nextPara = -1; |
405 | } | 413 | } |
406 | 414 | ||
407 | reclen -= HeaderSize()+4*m_nParas; | 415 | reclen -= HeaderSize()+4*m_nParas; |
@@ -410,15 +418,15 @@ bool CPlucker_base::expand(int thisrec) | |||
410 | 418 | ||
411 | if (thishdr_size > buffersize) | 419 | if (thishdr_size > buffersize) |
412 | { | 420 | { |
413 | delete [] expandedtextbuffer; | 421 | delete [] expandedtextbuffer; |
414 | buffersize = thishdr_size; | 422 | buffersize = thishdr_size; |
415 | expandedtextbuffer = new UInt8[buffersize]; | 423 | expandedtextbuffer = new UInt8[buffersize]; |
416 | } | 424 | } |
417 | 425 | ||
418 | Expand(reclen, thishdr_type, expandedtextbuffer, buffercontent); | 426 | Expand(reclen, thishdr_type, expandedtextbuffer, buffercontent); |
419 | bufferpos = 0; | 427 | bufferpos = 0; |
420 | bufferrec = thisrec; | 428 | bufferrec = thisrec; |
421 | //qDebug("BC:%u, HS:%u", buffercontent, thishdr_size); | 429 | //odebug << "BC:" << buffercontent << ", HS:" << thishdr_size << "" << oendl; |
422 | return true; | 430 | return true; |
423 | } | 431 | } |
424 | 432 | ||
@@ -436,9 +444,9 @@ void CPlucker_base::UnZip(UInt8* compressedbuffer, size_t reclen, UInt8* tgtbuff | |||
436 | zstream.zalloc = Z_NULL; | 444 | zstream.zalloc = Z_NULL; |
437 | zstream.zfree = Z_NULL; | 445 | zstream.zfree = Z_NULL; |
438 | zstream.opaque = Z_NULL; | 446 | zstream.opaque = Z_NULL; |
439 | 447 | ||
440 | // printf("Initialising\n"); | 448 | // printf("Initialising\n"); |
441 | 449 | ||
442 | inflateInit(&zstream); | 450 | inflateInit(&zstream); |
443 | int err = 0; | 451 | int err = 0; |
444 | do { | 452 | do { |
@@ -452,7 +460,7 @@ void CPlucker_base::UnZip(UInt8* compressedbuffer, size_t reclen, UInt8* tgtbuff | |||
452 | 460 | ||
453 | err = inflate( &zstream, Z_SYNC_FLUSH ); | 461 | err = inflate( &zstream, Z_SYNC_FLUSH ); |
454 | 462 | ||
455 | ////qDebug("err:%d - %u", err, zstream.avail_in); | 463 | // //odebug << "err:" << err << " - " << zstream.avail_in << "" << oendl; |
456 | 464 | ||
457 | } while ( err == Z_OK ); | 465 | } while ( err == Z_OK ); |
458 | 466 | ||
@@ -527,16 +535,16 @@ CList<Bkmk>* CPlucker_base::getbkmklist() | |||
527 | 535 | ||
528 | for (int i = 1; i < ntohs(head.recordList.numRecords); i++) | 536 | for (int i = 1; i < ntohs(head.recordList.numRecords); i++) |
529 | { | 537 | { |
530 | gotorecordnumber(i); | 538 | gotorecordnumber(i); |
531 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 539 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
532 | if (thishdr_type == 8) | 540 | if (thishdr_type == 8) |
533 | { | 541 | { |
534 | UInt16 n; | 542 | UInt16 n; |
535 | fread(&n, 1, sizeof(n), fin); | 543 | fread(&n, 1, sizeof(n), fin); |
536 | n = ntohs(n); | 544 | n = ntohs(n); |
537 | //qDebug("Found %u bookmarks", n); | 545 | //odebug << "Found " << n << " bookmarks" << oendl; |
538 | } | 546 | } |
539 | //qDebug("Found:%d, %u", i , thishdr_type); | 547 | //odebug << "Found:" << i << ", " << thishdr_type << "" << oendl; |
540 | } | 548 | } |
541 | */ | 549 | */ |
542 | return NULL; | 550 | return NULL; |
@@ -550,18 +558,18 @@ QImage* CPlucker_base::expandimg(UInt16 tgt, bool border) | |||
550 | if (qimage == NULL) return NULL; | 558 | if (qimage == NULL) return NULL; |
551 | if (border) | 559 | if (border) |
552 | { | 560 | { |
553 | QPixmap* image = new QPixmap(0,0); | 561 | QPixmap* image = new QPixmap(0,0); |
554 | image->convertFromImage(*qimage); | 562 | image->convertFromImage(*qimage); |
555 | delete qimage; | 563 | delete qimage; |
556 | QPixmap* pret = new QPixmap(image->width()+4, image->height()+4); | 564 | QPixmap* pret = new QPixmap(image->width()+4, image->height()+4); |
557 | pret->fill(Qt::red); | 565 | pret->fill(Qt::red); |
558 | bitBlt(pret, 2, 2, image, 0, 0, -1, -1);//, Qt::RasterOp::CopyROP); | 566 | bitBlt(pret, 2, 2, image, 0, 0, -1, -1);//, Qt::RasterOp::CopyROP); |
559 | delete image; | 567 | delete image; |
560 | ret = new QImage(pret->convertToImage()); | 568 | ret = new QImage(pret->convertToImage()); |
561 | } | 569 | } |
562 | else | 570 | else |
563 | { | 571 | { |
564 | ret = qimage; | 572 | ret = qimage; |
565 | } | 573 | } |
566 | return ret; | 574 | return ret; |
567 | } | 575 | } |
@@ -577,11 +585,11 @@ QImage* CPlucker_base::getPicture(unsigned long tgt) | |||
577 | QMap<unsigned long, QPixmap>::Iterator t = pix.find(tgt); | 585 | QMap<unsigned long, QPixmap>::Iterator t = pix.find(tgt); |
578 | if (t == pix.end()) | 586 | if (t == pix.end()) |
579 | { | 587 | { |
580 | pix[tgt] = *expandimg(tgt); | 588 | pix[tgt] = *expandimg(tgt); |
581 | return &pix[tgt]; | 589 | return &pix[tgt]; |
582 | } | 590 | } |
583 | else | 591 | else |
584 | return &(t.data()); | 592 | return &(t.data()); |
585 | #else | 593 | #else |
586 | return expandimg(tgt >> 16); | 594 | return expandimg(tgt >> 16); |
587 | #endif | 595 | #endif |
@@ -592,7 +600,7 @@ QImage* CPlucker_base::getPicture(unsigned long tgt) | |||
592 | #include <qpe/global.h> | 600 | #include <qpe/global.h> |
593 | void CPlucker_base::showimg(UInt16 tgt) | 601 | void CPlucker_base::showimg(UInt16 tgt) |
594 | { | 602 | { |
595 | //qDebug("Crassssssh!"); | 603 | //odebug << "Crassssssh!" << oendl; |
596 | QPixmap* qimage = expandimg(tgt); | 604 | QPixmap* qimage = expandimg(tgt); |
597 | m_picture->setFixedSize(qimage->size()); | 605 | m_picture->setFixedSize(qimage->size()); |
598 | m_picture->setBackgroundPixmap(*qimage); | 606 | m_picture->setBackgroundPixmap(*qimage); |
@@ -603,18 +611,18 @@ void CPlucker_base::showimg(UInt16 tgt) | |||
603 | char tmp[] = "uqtreader.XXXXXX"; | 611 | char tmp[] = "uqtreader.XXXXXX"; |
604 | QImage* qimage = getimg(tgt); | 612 | QImage* qimage = getimg(tgt); |
605 | QPixmap* image = new QPixmap(0,0); | 613 | QPixmap* image = new QPixmap(0,0); |
606 | // //qDebug("New image"); | 614 | // //odebug << "New image" << oendl; |
607 | image->convertFromImage(*qimage); | 615 | image->convertFromImage(*qimage); |
608 | delete qimage; | 616 | delete qimage; |
609 | char tmpfile[sizeof(tmp)+1]; | 617 | char tmpfile[sizeof(tmp)+1]; |
610 | strcpy(tmpfile,tmp); | 618 | strcpy(tmpfile,tmp); |
611 | int f = mkstemp(tmpfile); | 619 | int f = mkstemp(tmpfile); |
612 | close(f); | 620 | close(f); |
613 | //qDebug("TMPFILE:%s", tmpfile); | 621 | //odebug << "TMPFILE:" << tmpfile << "" << oendl; |
614 | if (image->save(tmpfile,"PNG")) | 622 | if (image->save(tmpfile,"PNG")) |
615 | { | 623 | { |
616 | QCopEnvelope e("QPE/Application/showimg", "setDocument(QString)"); | 624 | QCopEnvelope e("QPE/Application/showimg", "setDocument(QString)"); |
617 | e << QString(tmpfile); | 625 | e << QString(tmpfile); |
618 | } | 626 | } |
619 | Global::statusMessage("Opening image"); | 627 | Global::statusMessage("Opening image"); |
620 | sleep(5); | 628 | sleep(5); |
@@ -627,31 +635,31 @@ void CPlucker_base::showimg(UInt16 tgt) | |||
627 | 635 | ||
628 | unsigned short CPlucker_base::finduid(unsigned short urlid) | 636 | unsigned short CPlucker_base::finduid(unsigned short urlid) |
629 | { | 637 | { |
630 | // //qDebug("Finding %u", urlid); | 638 | // //odebug << "Finding " << urlid << "" << oendl; |
631 | unsigned short jmin = 1, jmax = ntohs(head.recordList.numRecords); | 639 | unsigned short jmin = 1, jmax = ntohs(head.recordList.numRecords); |
632 | unsigned short jmid = (jmin+jmax) >> 1; | 640 | unsigned short jmid = (jmin+jmax) >> 1; |
633 | while (jmax - jmin > 1) | 641 | while (jmax - jmin > 1) |
634 | { | 642 | { |
635 | gotorecordnumber(jmid); | 643 | gotorecordnumber(jmid); |
636 | UInt16 thishdr_uid, thishdr_nParagraphs; | 644 | UInt16 thishdr_uid, thishdr_nParagraphs; |
637 | UInt32 thishdr_size; | 645 | UInt32 thishdr_size; |
638 | UInt8 thishdr_type, thishdr_reserved; | 646 | UInt8 thishdr_type, thishdr_reserved; |
639 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 647 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
640 | unsigned short luid = thishdr_uid; | 648 | unsigned short luid = thishdr_uid; |
641 | ////qDebug("%u %u %u : %u", jmin, jmid, jmax, urlid); | 649 | // //odebug << "" << jmin << " " << jmid << " " << jmax << " : " << urlid << "" << oendl; |
642 | if (luid == urlid) | 650 | if (luid == urlid) |
643 | { | 651 | { |
644 | return jmid; | 652 | return jmid; |
645 | } | 653 | } |
646 | if (luid < urlid) | 654 | if (luid < urlid) |
647 | { | 655 | { |
648 | jmin = jmid; | 656 | jmin = jmid; |
649 | } | 657 | } |
650 | else | 658 | else |
651 | { | 659 | { |
652 | jmax = jmid; | 660 | jmax = jmid; |
653 | } | 661 | } |
654 | jmid = (jmin+jmax) >> 1; | 662 | jmid = (jmin+jmax) >> 1; |
655 | } | 663 | } |
656 | gotorecordnumber(jmin); | 664 | gotorecordnumber(jmin); |
657 | UInt16 thishdr_uid, thishdr_nParagraphs; | 665 | UInt16 thishdr_uid, thishdr_nParagraphs; |
@@ -659,20 +667,20 @@ unsigned short CPlucker_base::finduid(unsigned short urlid) | |||
659 | UInt8 thishdr_type, thishdr_reserved; | 667 | UInt8 thishdr_type, thishdr_reserved; |
660 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 668 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
661 | unsigned short luid = thishdr_uid; | 669 | unsigned short luid = thishdr_uid; |
662 | //qDebug("jmin at end:%u,%u", jmin, luid); | 670 | //odebug << "jmin at end:" << jmin << "," << luid << "" << oendl; |
663 | if (luid == urlid) | 671 | if (luid == urlid) |
664 | { | 672 | { |
665 | return jmin; | 673 | return jmin; |
666 | } | 674 | } |
667 | gotorecordnumber(jmax); | 675 | gotorecordnumber(jmax); |
668 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 676 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
669 | luid = thishdr_uid; | 677 | luid = thishdr_uid; |
670 | //qDebug("jmax at end:%u,%u", jmax, luid); | 678 | //odebug << "jmax at end:" << jmax << "," << luid << "" << oendl; |
671 | if (luid == urlid) | 679 | if (luid == urlid) |
672 | { | 680 | { |
673 | return jmax; | 681 | return jmax; |
674 | } | 682 | } |
675 | //qDebug("Couldn't find %u", urlid); | 683 | //odebug << "Couldn't find " << urlid << "" << oendl; |
676 | return 0; // Not found! | 684 | return 0; // Not found! |
677 | } | 685 | } |
678 | 686 | ||
@@ -682,7 +690,7 @@ void CPlucker_base::setSaveData(unsigned char*& data, unsigned short& len, unsig | |||
682 | unsigned short sz = 0; | 690 | unsigned short sz = 0; |
683 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) | 691 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) |
684 | { | 692 | { |
685 | sz++; | 693 | sz++; |
686 | } | 694 | } |
687 | size_t newlen = srclen+sizeof(sz)+sz*sizeof(unsigned long); | 695 | size_t newlen = srclen+sizeof(sz)+sz*sizeof(unsigned long); |
688 | unsigned char* newdata = new unsigned char[newlen]; | 696 | unsigned char* newdata = new unsigned char[newlen]; |
@@ -697,10 +705,10 @@ void CPlucker_base::setSaveData(unsigned char*& data, unsigned short& len, unsig | |||
697 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) | 705 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) |
698 | #endif | 706 | #endif |
699 | { | 707 | { |
700 | unsigned long t = *it; | 708 | unsigned long t = *it; |
701 | //qDebug("[%u]", t); | 709 | // odebug << "[" << t << "]" << oendl; |
702 | memcpy(newdata, &t, sizeof(t)); | 710 | memcpy(newdata, &t, sizeof(t)); |
703 | newdata += sizeof(t); | 711 | newdata += sizeof(t); |
704 | } | 712 | } |
705 | m_nav.setSaveData(data, len, pdata, newlen); | 713 | m_nav.setSaveData(data, len, pdata, newlen); |
706 | delete [] pdata; | 714 | delete [] pdata; |
@@ -711,26 +719,26 @@ void CPlucker_base::putSaveData(unsigned char*& src, unsigned short& srclen) | |||
711 | unsigned short sz; | 719 | unsigned short sz; |
712 | if (srclen >= sizeof(sz)) | 720 | if (srclen >= sizeof(sz)) |
713 | { | 721 | { |
714 | memcpy(&sz, src, sizeof(sz)); | 722 | memcpy(&sz, src, sizeof(sz)); |
715 | src += sizeof(sz); | 723 | src += sizeof(sz); |
716 | srclen -= sizeof(sz); | 724 | srclen -= sizeof(sz); |
717 | } | 725 | } |
718 | for (int i = 0; i < sz; i++) | 726 | for (int i = 0; i < sz; i++) |
719 | { | 727 | { |
720 | unsigned long t; | 728 | unsigned long t; |
721 | if (srclen >= sizeof(t)) | 729 | if (srclen >= sizeof(t)) |
722 | { | 730 | { |
723 | memcpy(&t, src, sizeof(t)); | 731 | memcpy(&t, src, sizeof(t)); |
724 | // qDebug("[%u]", t); | 732 | // odebug << "[" << t << "]" << oendl; |
725 | visited.push_front(t); | 733 | visited.push_front(t); |
726 | src += sizeof(t); | 734 | src += sizeof(t); |
727 | srclen -= sizeof(t); | 735 | srclen -= sizeof(t); |
728 | } | 736 | } |
729 | else | 737 | else |
730 | { | 738 | { |
731 | QMessageBox::warning(NULL, PROGNAME, "File data mismatch\nMight fix itself"); | 739 | QMessageBox::warning(NULL, PROGNAME, "File data mismatch\nMight fix itself"); |
732 | break; | 740 | break; |
733 | } | 741 | } |
734 | } | 742 | } |
735 | m_nav.putSaveData(src, srclen); | 743 | m_nav.putSaveData(src, srclen); |
736 | } | 744 | } |
@@ -740,7 +748,7 @@ int CPlucker_base::OpenFile(const char *src) | |||
740 | m_lastBreak = 0; | 748 | m_lastBreak = 0; |
741 | if (!Cpdb::openfile(src)) | 749 | if (!Cpdb::openfile(src)) |
742 | { | 750 | { |
743 | return -1; | 751 | return -1; |
744 | } | 752 | } |
745 | 753 | ||
746 | if (!CorrectDecoder()) return -1; | 754 | if (!CorrectDecoder()) return -1; |
@@ -751,43 +759,43 @@ int CPlucker_base::OpenFile(const char *src) | |||
751 | compressedtextbuffer = new UInt8[compressedbuffersize]; | 759 | compressedtextbuffer = new UInt8[compressedbuffersize]; |
752 | expandedtextbuffer = new UInt8[buffersize]; | 760 | expandedtextbuffer = new UInt8[buffersize]; |
753 | 761 | ||
754 | //qDebug("Total number of records:%u", ntohs(head.recordList.numRecords)); | 762 | //odebug << "Total number of records:" << ntohs(head.recordList.numRecords) << "" << oendl; |
755 | 763 | ||
756 | unsigned int nrecs = ntohs(hdr0.nRecords); | 764 | unsigned int nrecs = ntohs(hdr0.nRecords); |
757 | //qDebug("Version %u, no. recs %u", ntohs(hdr0.version), nrecs); | 765 | //odebug << "Version " << ntohs(hdr0.version) << ", no. recs " << nrecs << "" << oendl; |
758 | UInt16 homerecid = 1; | 766 | UInt16 homerecid = 1; |
759 | for (unsigned int i = 0; i < nrecs; i++) | 767 | for (unsigned int i = 0; i < nrecs; i++) |
760 | { | 768 | { |
761 | UInt16 id, name; | 769 | UInt16 id, name; |
762 | fread(&name, 1, sizeof(name), fin); | 770 | fread(&name, 1, sizeof(name), fin); |
763 | fread(&id, 1, sizeof(id), fin); | 771 | fread(&id, 1, sizeof(id), fin); |
764 | //qDebug("N:%d, I:%d", ntohs(name), ntohs(id)); | 772 | //odebug << "N:" << ntohs(name) << ", I:" << ntohs(id) << "" << oendl; |
765 | if (ntohs(name) == 0) homerecid = ntohs(id); | 773 | if (ntohs(name) == 0) homerecid = ntohs(id); |
766 | } | 774 | } |
767 | 775 | ||
768 | textlength = 0; | 776 | textlength = 0; |
769 | for (int recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) | 777 | for (int recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) |
770 | { | 778 | { |
771 | gotorecordnumber(recptr); | 779 | gotorecordnumber(recptr); |
772 | UInt16 thishdr_uid, thishdr_nParagraphs; | 780 | UInt16 thishdr_uid, thishdr_nParagraphs; |
773 | UInt32 thishdr_size; | 781 | UInt32 thishdr_size; |
774 | UInt8 thishdr_type, thishdr_reserved; | 782 | UInt8 thishdr_type, thishdr_reserved; |
775 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 783 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
776 | if (thishdr_uid == homerecid) | 784 | if (thishdr_uid == homerecid) |
777 | { | 785 | { |
778 | m_homepos = textlength; | 786 | m_homepos = textlength; |
779 | break; | 787 | break; |
780 | } | 788 | } |
781 | if (thishdr_type < 2) textlength += thishdr_size; | 789 | if (thishdr_type < 2) textlength += thishdr_size; |
782 | } | 790 | } |
783 | textlength = 0; | 791 | textlength = 0; |
784 | home(); | 792 | home(); |
785 | #ifdef LOCALPICTURES | 793 | #ifdef LOCALPICTURES |
786 | if (m_viewer == NULL) | 794 | if (m_viewer == NULL) |
787 | { | 795 | { |
788 | m_viewer = new QScrollView(NULL); | 796 | m_viewer = new QScrollView(NULL); |
789 | m_picture = new QWidget(m_viewer->viewport()); | 797 | m_picture = new QWidget(m_viewer->viewport()); |
790 | m_viewer->addChild(m_picture); | 798 | m_viewer->addChild(m_picture); |
791 | } | 799 | } |
792 | #endif | 800 | #endif |
793 | return 0; | 801 | return 0; |
@@ -808,7 +816,7 @@ QImage* CPlucker_base::getimg(UInt16 tgt) | |||
808 | 816 | ||
809 | UInt32 imgsize = thishdr_size; | 817 | UInt32 imgsize = thishdr_size; |
810 | UInt8* imgbuffer = new UInt8[imgsize]; | 818 | UInt8* imgbuffer = new UInt8[imgsize]; |
811 | 819 | ||
812 | Expand(reclen, thishdr_type, imgbuffer, imgsize); | 820 | Expand(reclen, thishdr_type, imgbuffer, imgsize); |
813 | 821 | ||
814 | return imagefromdata(imgbuffer, imgsize); | 822 | return imagefromdata(imgbuffer, imgsize); |
@@ -819,7 +827,7 @@ linkType CPlucker_base::hyperlink(unsigned int n, QString& wrd) | |||
819 | visited.push_front(n); | 827 | visited.push_front(n); |
820 | UInt16 tuid = (n >> 16); | 828 | UInt16 tuid = (n >> 16); |
821 | n &= 0xffff; | 829 | n &= 0xffff; |
822 | // //qDebug("Hyper:<%u,%u>", tuid, n); | 830 | // //odebug << "Hyper:<" << tuid << "," << n << ">" << oendl; |
823 | UInt16 thisrec = 1; | 831 | UInt16 thisrec = 1; |
824 | currentpos = 0; | 832 | currentpos = 0; |
825 | gotorecordnumber(thisrec); | 833 | gotorecordnumber(thisrec); |
@@ -828,123 +836,123 @@ linkType CPlucker_base::hyperlink(unsigned int n, QString& wrd) | |||
828 | UInt8 thishdr_type, thishdr_reserved; | 836 | UInt8 thishdr_type, thishdr_reserved; |
829 | while (1) | 837 | while (1) |
830 | { | 838 | { |
831 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 839 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
832 | if (tuid == thishdr_uid) break; | 840 | if (tuid == thishdr_uid) break; |
833 | if (thishdr_type < 2) currentpos += thishdr_size; | 841 | if (thishdr_type < 2) currentpos += thishdr_size; |
834 | ////qDebug("hyper-cp:%u", currentpos); | 842 | // //odebug << "hyper-cp:" << currentpos << "" << oendl; |
835 | thisrec++; | 843 | thisrec++; |
836 | if (thisrec >= ntohs(head.recordList.numRecords)) | 844 | if (thisrec >= ntohs(head.recordList.numRecords)) |
837 | { | 845 | { |
838 | char *turl = geturl(tuid); | 846 | char *turl = geturl(tuid); |
839 | if (turl == NULL) | 847 | if (turl == NULL) |
840 | { | 848 | { |
841 | QMessageBox::information(NULL, | 849 | QMessageBox::information(NULL, |
842 | QString(PROGNAME), | 850 | QString(PROGNAME), |
843 | QString("Couldn't find link") | 851 | QString("Couldn't find link") |
844 | ); | 852 | ); |
845 | } | 853 | } |
846 | else | 854 | else |
847 | { | 855 | { |
848 | wrd = turl; | 856 | wrd = turl; |
849 | #ifdef USEQPE | 857 | #ifdef USEQPE |
850 | if (wrd.length() > 10) | 858 | if (wrd.length() > 10) |
851 | { | 859 | { |
852 | Global::statusMessage(wrd.left(8) + ".."); | 860 | Global::statusMessage(wrd.left(8) + ".."); |
853 | } | 861 | } |
854 | else | 862 | else |
855 | { | 863 | { |
856 | Global::statusMessage(wrd); | 864 | Global::statusMessage(wrd); |
857 | } | 865 | } |
858 | #else | 866 | #else |
859 | #endif /* USEQPE */ | 867 | #endif /* USEQPE */ |
860 | //qDebug("Link:%s", (const char*)wrd); | 868 | //odebug << "Link:" << wrd << "" << oendl; |
861 | // setlink(fn, wrd); | 869 | // setlink(fn, wrd); |
862 | delete [] turl; | 870 | delete [] turl; |
863 | } | 871 | } |
864 | return eNone; | 872 | return eNone; |
865 | } | 873 | } |
866 | gotorecordnumber(thisrec); | 874 | gotorecordnumber(thisrec); |
867 | } | 875 | } |
868 | if (thishdr_type > 1) | 876 | if (thishdr_type > 1) |
869 | { | 877 | { |
870 | if (thishdr_type == 4) | 878 | if (thishdr_type == 4) |
871 | { | 879 | { |
872 | QMessageBox::information(NULL, | 880 | QMessageBox::information(NULL, |
873 | QString(PROGNAME), | 881 | QString(PROGNAME), |
874 | QString("Mailto links\nnot yet supported (2)")); | 882 | QString("Mailto links\nnot yet supported (2)")); |
875 | } | 883 | } |
876 | else | 884 | else |
877 | { | 885 | { |
878 | if (thishdr_type > 3) | 886 | if (thishdr_type > 3) |
879 | { | 887 | { |
880 | QMessageBox::information(NULL, | 888 | QMessageBox::information(NULL, |
881 | QString(PROGNAME), | 889 | QString(PROGNAME), |
882 | QString("External links\nnot yet supported (2)") | 890 | QString("External links\nnot yet supported (2)") |
883 | ); | 891 | ); |
884 | return eNone; | 892 | return eNone; |
885 | } | 893 | } |
886 | else | 894 | else |
887 | { | 895 | { |
888 | #ifdef LOCALPICTURES | 896 | #ifdef LOCALPICTURES |
889 | showimg(tuid); | 897 | showimg(tuid); |
890 | #else | 898 | #else |
891 | return ePicture; | 899 | return ePicture; |
892 | #endif | 900 | #endif |
893 | } | 901 | } |
894 | } | 902 | } |
895 | return eNone; | 903 | return eNone; |
896 | } | 904 | } |
897 | /* | 905 | /* |
898 | if (thishdr_type == 2 || thishdr_type == 3) | 906 | if (thishdr_type == 2 || thishdr_type == 3) |
899 | { | 907 | { |
900 | expandimg(thisrec); | 908 | expandimg(thisrec); |
901 | 909 | ||
902 | } | 910 | } |
903 | */ | 911 | */ |
904 | else | 912 | else |
905 | { | 913 | { |
906 | expand(thisrec); | 914 | expand(thisrec); |
907 | if (n != 0) | 915 | if (n != 0) |
908 | { | 916 | { |
909 | if (n >= m_nParas) | 917 | if (n >= m_nParas) |
910 | { | 918 | { |
911 | QMessageBox::information(NULL, | 919 | QMessageBox::information(NULL, |
912 | QString(PROGNAME), | 920 | QString(PROGNAME), |
913 | QString("Error in link\nPara # too big") | 921 | QString("Error in link\nPara # too big") |
914 | ); | 922 | ); |
915 | return eNone; | 923 | return eNone; |
916 | } | 924 | } |
917 | unsigned int noff = 0; | 925 | unsigned int noff = 0; |
918 | for (unsigned int i = 0; i < n; i++) noff += m_ParaOffsets[i]; | 926 | for (unsigned int i = 0; i < n; i++) noff += m_ParaOffsets[i]; |
919 | n = noff; | 927 | n = noff; |
920 | } | 928 | } |
921 | if (n > thishdr_size) | 929 | if (n > thishdr_size) |
922 | { | 930 | { |
923 | QMessageBox::information(NULL, | 931 | QMessageBox::information(NULL, |
924 | QString(PROGNAME), | 932 | QString(PROGNAME), |
925 | QString("Error in link\nOffset too big") | 933 | QString("Error in link\nOffset too big") |
926 | ); | 934 | ); |
927 | return eNone; | 935 | return eNone; |
928 | } | 936 | } |
929 | //qDebug("Hyper:<%u,%u>", tuid, n); | 937 | //odebug << "Hyper:<" << tuid << "," << n << ">" << oendl; |
930 | while (bufferpos < n && bufferpos < buffercontent) getch_base(true); | 938 | while (bufferpos < n && bufferpos < buffercontent) getch_base(true); |
931 | /* // This is faster but the alignment doesn't get set | 939 | /* // This is faster but the alignment doesn't get set |
932 | mystyle.unset(); | 940 | mystyle.unset(); |
933 | bufferpos = n; | 941 | bufferpos = n; |
934 | currentpos += n; | 942 | currentpos += n; |
935 | while (bufferpos >= m_nextPara && m_nextPara >= 0) | 943 | while (bufferpos >= m_nextPara && m_nextPara >= 0) |
936 | { | 944 | { |
937 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; | 945 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; |
938 | m_nextParaIndex++; | 946 | m_nextParaIndex++; |
939 | if (m_nextParaIndex == m_nParas) | 947 | if (m_nextParaIndex == m_nParas) |
940 | { | 948 | { |
941 | m_nextPara = -1; | 949 | m_nextPara = -1; |
942 | } | 950 | } |
943 | else | 951 | else |
944 | { | 952 | { |
945 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; | 953 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; |
946 | } | 954 | } |
947 | } | 955 | } |
948 | */ | 956 | */ |
949 | } | 957 | } |
950 | return eLink; | 958 | return eLink; |
@@ -955,278 +963,278 @@ tchar CPlucker_base::getch_base(bool fast) | |||
955 | int ch = bgetch(); | 963 | int ch = bgetch(); |
956 | while (ch == 0) | 964 | while (ch == 0) |
957 | { | 965 | { |
958 | ch = bgetch(); | 966 | ch = bgetch(); |
959 | ////qDebug("Function:%x", ch); | 967 | // //odebug << "Function:" << ch << "" << oendl; |
960 | switch (ch) | 968 | switch (ch) |
961 | { | 969 | { |
962 | case 0x38: | 970 | case 0x38: |
963 | // //qDebug("Break:%u", locate()); | 971 | // //odebug << "Break:" << locate() << "" << oendl; |
964 | if (m_lastBreak == locate()) | 972 | if (m_lastBreak == locate()) |
965 | { | 973 | { |
966 | ch = bgetch(); | 974 | ch = bgetch(); |
967 | } | 975 | } |
968 | else | 976 | else |
969 | { | 977 | { |
970 | ch = 10; | 978 | ch = 10; |
971 | } | 979 | } |
972 | m_lastBreak = locate(); | 980 | m_lastBreak = locate(); |
973 | break; | 981 | break; |
974 | case 0x0a: | 982 | case 0x0a: |
975 | case 0x0c: | 983 | case 0x0c: |
976 | { | 984 | { |
977 | unsigned long ln = 0; | 985 | unsigned long ln = 0; |
978 | int skip = ch & 7; | 986 | int skip = ch & 7; |
979 | for (int i = 0; i < 2; i++) | 987 | for (int i = 0; i < 2; i++) |
980 | { | 988 | { |
981 | int ch = bgetch(); | 989 | int ch = bgetch(); |
982 | ln = (ln << 8) + ch; | 990 | ln = (ln << 8) + ch; |
983 | // //qDebug("ch:%d, ln:%u", ch, ln); | 991 | // //odebug << "ch:" << ch << ", ln:" << ln << "" << oendl; |
984 | } | 992 | } |
985 | if (skip == 2) | 993 | if (skip == 2) |
986 | { | 994 | { |
987 | ln <<= 16; | 995 | ln <<= 16; |
988 | } | 996 | } |
989 | else | 997 | else |
990 | { | 998 | { |
991 | for (int i = 0; i < 2; i++) | 999 | for (int i = 0; i < 2; i++) |
992 | { | 1000 | { |
993 | int ch = bgetch(); | 1001 | int ch = bgetch(); |
994 | ln = (ln << 8) + ch; | 1002 | ln = (ln << 8) + ch; |
995 | // //qDebug("ch:%d, ln:%u", ch, ln); | 1003 | // //odebug << "ch:" << ch << ", ln:" << ln << "" << oendl; |
996 | } | 1004 | } |
997 | } | 1005 | } |
998 | // //qDebug("ln:%u", ln); | 1006 | // //odebug << "ln:" << ln << "" << oendl; |
999 | mystyle.setLink(true); | 1007 | mystyle.setLink(true); |
1000 | mystyle.setData(ln); | 1008 | mystyle.setData(ln); |
1001 | // mystyle.setColour(255, 0, 0); | 1009 | // mystyle.setColour(255, 0, 0); |
1002 | bool hasseen = false; | 1010 | bool hasseen = false; |
1003 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) | 1011 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) |
1004 | { | 1012 | { |
1005 | if (*it == ln) | 1013 | if (*it == ln) |
1006 | { | 1014 | { |
1007 | hasseen = true; | 1015 | hasseen = true; |
1008 | break; | 1016 | break; |
1009 | } | 1017 | } |
1010 | } | 1018 | } |
1011 | if (hasseen) | 1019 | if (hasseen) |
1012 | { | 1020 | { |
1013 | mystyle.setStrikethru(); | 1021 | mystyle.setStrikethru(); |
1014 | } | 1022 | } |
1015 | else | 1023 | else |
1016 | { | 1024 | { |
1017 | mystyle.setUnderline(); | 1025 | mystyle.setUnderline(); |
1018 | } | 1026 | } |
1019 | ch = bgetch(); | 1027 | ch = bgetch(); |
1020 | } | 1028 | } |
1021 | break; | 1029 | break; |
1022 | case 0x08: | 1030 | case 0x08: |
1023 | ch = bgetch(); | 1031 | ch = bgetch(); |
1024 | // mystyle.setColour(0, 0, 0); | 1032 | // mystyle.setColour(0, 0, 0); |
1025 | mystyle.unsetUnderline(); | 1033 | mystyle.unsetUnderline(); |
1026 | mystyle.unsetStrikethru(); | 1034 | mystyle.unsetStrikethru(); |
1027 | mystyle.setLink(false); | 1035 | mystyle.setLink(false); |
1028 | mystyle.setData(0); | 1036 | mystyle.setData(0); |
1029 | break; | 1037 | break; |
1030 | case 0x40: | 1038 | case 0x40: |
1031 | mystyle.setItalic(); | 1039 | mystyle.setItalic(); |
1032 | ch = bgetch(); | 1040 | ch = bgetch(); |
1033 | break; | 1041 | break; |
1034 | case 0x48: | 1042 | case 0x48: |
1035 | mystyle.unsetItalic(); | 1043 | mystyle.unsetItalic(); |
1036 | ch = bgetch(); | 1044 | ch = bgetch(); |
1037 | break; | 1045 | break; |
1038 | case 0x11: | 1046 | case 0x11: |
1039 | { | 1047 | { |
1040 | ch = bgetch(); | 1048 | ch = bgetch(); |
1041 | // //qDebug("Font:%d",ch); | 1049 | // //odebug << "Font:" << ch << "" << oendl; |
1042 | mystyle.setVOffset(0); | 1050 | mystyle.setVOffset(0); |
1043 | mystyle.unsetMono(); | 1051 | mystyle.unsetMono(); |
1044 | mystyle.unsetBold(); | 1052 | mystyle.unsetBold(); |
1045 | mystyle.setFontSize(0); | 1053 | mystyle.setFontSize(0); |
1046 | switch (ch) | 1054 | switch (ch) |
1047 | { | 1055 | { |
1048 | case 0: | 1056 | case 0: |
1049 | break; | 1057 | break; |
1050 | case 1: | 1058 | case 1: |
1051 | mystyle.setBold(); | 1059 | mystyle.setBold(); |
1052 | mystyle.setFontSize(3); | 1060 | mystyle.setFontSize(3); |
1053 | break; | 1061 | break; |
1054 | case 2: | 1062 | case 2: |
1055 | mystyle.setBold(); | 1063 | mystyle.setBold(); |
1056 | mystyle.setFontSize(2); | 1064 | mystyle.setFontSize(2); |
1057 | break; | 1065 | break; |
1058 | case 3: | 1066 | case 3: |
1059 | mystyle.setBold(); | 1067 | mystyle.setBold(); |
1060 | mystyle.setFontSize(1); | 1068 | mystyle.setFontSize(1); |
1061 | break; | 1069 | break; |
1062 | case 4: | 1070 | case 4: |
1063 | mystyle.setBold(); | 1071 | mystyle.setBold(); |
1064 | break; | 1072 | break; |
1065 | case 5: | 1073 | case 5: |
1066 | mystyle.setBold(); | 1074 | mystyle.setBold(); |
1067 | break; | 1075 | break; |
1068 | case 6: | 1076 | case 6: |
1069 | mystyle.setBold(); | 1077 | mystyle.setBold(); |
1070 | break; | 1078 | break; |
1071 | case 7: | 1079 | case 7: |
1072 | mystyle.setBold(); | 1080 | mystyle.setBold(); |
1073 | break; | 1081 | break; |
1074 | case 8: // should be fixed width | 1082 | case 8: // should be fixed width |
1075 | //qDebug("Trying fixed width"); | 1083 | //odebug << "Trying fixed width" << oendl; |
1076 | mystyle.setMono(); | 1084 | mystyle.setMono(); |
1077 | break; | 1085 | break; |
1078 | case 9: | 1086 | case 9: |
1079 | mystyle.setFontSize(-1); | 1087 | mystyle.setFontSize(-1); |
1080 | break; | 1088 | break; |
1081 | case 10: | 1089 | case 10: |
1082 | mystyle.setFontSize(-2); | 1090 | mystyle.setFontSize(-2); |
1083 | mystyle.setVOffset(1); | 1091 | mystyle.setVOffset(1); |
1084 | break; | 1092 | break; |
1085 | case 11: | 1093 | case 11: |
1086 | mystyle.setFontSize(-2); | 1094 | mystyle.setFontSize(-2); |
1087 | mystyle.setVOffset(-1); | 1095 | mystyle.setVOffset(-1); |
1088 | break; | 1096 | break; |
1089 | default: | 1097 | default: |
1090 | qDebug("Unrecognised font"); | 1098 | odebug << "Unrecognised font" << oendl; |
1091 | break; | 1099 | break; |
1092 | } | 1100 | } |
1093 | ch = bgetch(); | 1101 | ch = bgetch(); |
1094 | } | 1102 | } |
1095 | break; | 1103 | break; |
1096 | case 0x29: | 1104 | case 0x29: |
1097 | ch = bgetch(); | 1105 | ch = bgetch(); |
1098 | switch (ch) | 1106 | switch (ch) |
1099 | { | 1107 | { |
1100 | case 0: | 1108 | case 0: |
1101 | mystyle.setLeftJustify(); | 1109 | mystyle.setLeftJustify(); |
1102 | // //qDebug("left"); | 1110 | // //odebug << "left" << oendl; |
1103 | break; | 1111 | break; |
1104 | case 1: | 1112 | case 1: |
1105 | mystyle.setRightJustify(); | 1113 | mystyle.setRightJustify(); |
1106 | // //qDebug("right"); | 1114 | // //odebug << "right" << oendl; |
1107 | break; | 1115 | break; |
1108 | case 2: | 1116 | case 2: |
1109 | mystyle.setCentreJustify(); | 1117 | mystyle.setCentreJustify(); |
1110 | // //qDebug("centre"); | 1118 | // //odebug << "centre" << oendl; |
1111 | break; | 1119 | break; |
1112 | case 3: | 1120 | case 3: |
1113 | mystyle.setFullJustify(); | 1121 | mystyle.setFullJustify(); |
1114 | // //qDebug("full"); | 1122 | // //odebug << "full" << oendl; |
1115 | break; | 1123 | break; |
1116 | 1124 | ||
1117 | } | 1125 | } |
1118 | ch = bgetch(); | 1126 | ch = bgetch(); |
1119 | break; | 1127 | break; |
1120 | case 0x53: | 1128 | case 0x53: |
1121 | { | 1129 | { |
1122 | int r = bgetch(); | 1130 | int r = bgetch(); |
1123 | int g = bgetch(); | 1131 | int g = bgetch(); |
1124 | int b = bgetch(); | 1132 | int b = bgetch(); |
1125 | mystyle.setColour(r,g,b); | 1133 | mystyle.setColour(r,g,b); |
1126 | ch = bgetch(); | 1134 | ch = bgetch(); |
1127 | } | 1135 | } |
1128 | break; | 1136 | break; |
1129 | case 0x1a: | 1137 | case 0x1a: |
1130 | case 0x5c: | 1138 | case 0x5c: |
1131 | { | 1139 | { |
1132 | bool hasalternate = (ch == 0x5c); | 1140 | bool hasalternate = (ch == 0x5c); |
1133 | UInt16 ir = bgetch(); | 1141 | UInt16 ir = bgetch(); |
1134 | ir = (ir << 8) + bgetch(); | 1142 | ir = (ir << 8) + bgetch(); |
1135 | if (hasalternate) | 1143 | if (hasalternate) |
1136 | { | 1144 | { |
1137 | //qDebug("Alternate image:%x", ir); | 1145 | //odebug << "Alternate image:" << ir << "" << oendl; |
1138 | UInt16 ir2 = bgetch(); | 1146 | UInt16 ir2 = bgetch(); |
1139 | ir2 = (ir2 << 8) + bgetch(); | 1147 | ir2 = (ir2 << 8) + bgetch(); |
1140 | if (!fast) mystyle.setPicture(true, expandimg(ir2, true), true, ir << 16); | 1148 | if (!fast) mystyle.setPicture(true, expandimg(ir2, true), true, ir << 16); |
1141 | #ifdef LOCALPICTURES | 1149 | #ifdef LOCALPICTURES |
1142 | UInt32 ln = ir; | 1150 | UInt32 ln = ir; |
1143 | ln <<= 16; | 1151 | ln <<= 16; |
1144 | mystyle.setLink(true); | 1152 | mystyle.setLink(true); |
1145 | mystyle.setData(ln); | 1153 | mystyle.setData(ln); |
1146 | #endif | 1154 | #endif |
1147 | } | 1155 | } |
1148 | else | 1156 | else |
1149 | { | 1157 | { |
1150 | if (!fast) mystyle.setPicture(true, expandimg(ir)); | 1158 | if (!fast) mystyle.setPicture(true, expandimg(ir)); |
1151 | } | 1159 | } |
1152 | // if (mystyle.getLink()) qDebug("Picture link!"); | 1160 | // if (mystyle.getLink()) odebug << "Picture link!" << oendl; |
1153 | ch = '#'; | 1161 | ch = '#'; |
1154 | } | 1162 | } |
1155 | // ch = bgetch(); | 1163 | // ch = bgetch(); |
1156 | break; | 1164 | break; |
1157 | case 0x33: | 1165 | case 0x33: |
1158 | { | 1166 | { |
1159 | UInt8 h = bgetch(); | 1167 | UInt8 h = bgetch(); |
1160 | UInt8 wc = bgetch(); | 1168 | UInt8 wc = bgetch(); |
1161 | UInt8 pc = bgetch(); | 1169 | UInt8 pc = bgetch(); |
1162 | UInt16 w = wc; | 1170 | UInt16 w = wc; |
1163 | // //qDebug("h,w,pc [%u, %u, %u]", h, w, pc); | 1171 | // //odebug << "h,w,pc [" << h << ", " << w << ", " << pc << "]" << oendl; |
1164 | if (w == 0) | 1172 | if (w == 0) |
1165 | { | 1173 | { |
1166 | w = (m_scrWidth*(unsigned long)pc)/100; | 1174 | w = (m_scrWidth*(unsigned long)pc)/100; |
1167 | } | 1175 | } |
1168 | if (w == 0) w = m_scrWidth; | 1176 | if (w == 0) w = m_scrWidth; |
1169 | mystyle.setPicture(false, hRule(w,h,mystyle.Red(),mystyle.Green(),mystyle.Blue())); | 1177 | mystyle.setPicture(false, hRule(w,h,mystyle.Red(),mystyle.Green(),mystyle.Blue())); |
1170 | // if (mystyle.getLink()) //qDebug("hRule link!"); | 1178 | // if (mystyle.getLink()) //odebug << "hRule link!" << oendl; |
1171 | ch = '#'; | 1179 | ch = '#'; |
1172 | } | 1180 | } |
1173 | break; | 1181 | break; |
1174 | case 0x60: | 1182 | case 0x60: |
1175 | mystyle.setUnderline(); | 1183 | mystyle.setUnderline(); |
1176 | ch = bgetch(); | 1184 | ch = bgetch(); |
1177 | break; | 1185 | break; |
1178 | case 0x68: | 1186 | case 0x68: |
1179 | mystyle.unsetUnderline(); | 1187 | mystyle.unsetUnderline(); |
1180 | ch = bgetch(); | 1188 | ch = bgetch(); |
1181 | break; | 1189 | break; |
1182 | case 0x22: | 1190 | case 0x22: |
1183 | ch = bgetch(); | 1191 | ch = bgetch(); |
1184 | mystyle.setLeftMargin(ch); | 1192 | mystyle.setLeftMargin(ch); |
1185 | // //qDebug("Left margin:%d", ch); | 1193 | // //odebug << "Left margin:" << ch << "" << oendl; |
1186 | ch = bgetch(); | 1194 | ch = bgetch(); |
1187 | mystyle.setRightMargin(ch); | 1195 | mystyle.setRightMargin(ch); |
1188 | // //qDebug("Right margin:%d", ch); | 1196 | // //odebug << "Right margin:" << ch << "" << oendl; |
1189 | ch = bgetch(); | 1197 | ch = bgetch(); |
1190 | break; | 1198 | break; |
1191 | case 0x70: | 1199 | case 0x70: |
1192 | mystyle.setStrikethru(); | 1200 | mystyle.setStrikethru(); |
1193 | ch = bgetch(); | 1201 | ch = bgetch(); |
1194 | break; | 1202 | break; |
1195 | case 0x78: | 1203 | case 0x78: |
1196 | mystyle.unsetStrikethru(); | 1204 | mystyle.unsetStrikethru(); |
1197 | ch = bgetch(); | 1205 | ch = bgetch(); |
1198 | break; | 1206 | break; |
1199 | case 0x83: | 1207 | case 0x83: |
1200 | { | 1208 | { |
1201 | int tlen = bgetch(); | 1209 | int tlen = bgetch(); |
1202 | ch = bgetch(); | 1210 | ch = bgetch(); |
1203 | ch <<= 8; | 1211 | ch <<= 8; |
1204 | ch |= (tchar)bgetch(); | 1212 | ch |= (tchar)bgetch(); |
1205 | for (int i = 0; i < tlen; i++) bgetch(); | 1213 | for (int i = 0; i < tlen; i++) bgetch(); |
1206 | //qDebug("Function 83"); | 1214 | //odebug << "Function 83" << oendl; |
1207 | } | 1215 | } |
1208 | break; | 1216 | break; |
1209 | case 0x85: | 1217 | case 0x85: |
1210 | default: | 1218 | default: |
1211 | qDebug("Function:%x NOT IMPLEMENTED", ch); | 1219 | odebug << "Function:" << ch << " NOT IMPLEMENTED" << oendl; |
1212 | { | 1220 | { |
1213 | int skip = ch & 7; | 1221 | int skip = ch & 7; |
1214 | for (int i = 0; i < skip; i++) | 1222 | for (int i = 0; i < skip; i++) |
1215 | { | 1223 | { |
1216 | ch = bgetch(); | 1224 | ch = bgetch(); |
1217 | //qDebug("Arg %d, %d", i, ch); | 1225 | //odebug << "Arg " << i << ", " << ch << "" << oendl; |
1218 | } | 1226 | } |
1219 | ch = bgetch(); | 1227 | ch = bgetch(); |
1220 | } | 1228 | } |
1221 | } | 1229 | } |
1222 | } | 1230 | } |
1223 | 1231 | ||
1224 | if (m_lastIsBreak && !mystyle.isMono()) | 1232 | if (m_lastIsBreak && !mystyle.isMono()) |
1225 | { | 1233 | { |
1226 | while (ch == ' ') | 1234 | while (ch == ' ') |
1227 | { | 1235 | { |
1228 | ch = getch(false); | 1236 | ch = getch(false); |
1229 | } | 1237 | } |
1230 | } | 1238 | } |
1231 | 1239 | ||
1232 | m_lastIsBreak = (ch == 10); | 1240 | m_lastIsBreak = (ch == 10); |