summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/BuffDoc.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/BuffDoc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/BuffDoc.cpp55
1 files changed, 53 insertions, 2 deletions
diff --git a/noncore/apps/opie-reader/BuffDoc.cpp b/noncore/apps/opie-reader/BuffDoc.cpp
index 1f0a524..355d14d 100644
--- a/noncore/apps/opie-reader/BuffDoc.cpp
+++ b/noncore/apps/opie-reader/BuffDoc.cpp
@@ -3,7 +3,6 @@
3#define NEWLINEBREAK 3#define NEWLINEBREAK
4#define INCREMENTALWIDTH 4#define INCREMENTALWIDTH
5 5
6#include "usenef.h"
7#include "BuffDoc.h" 6#include "BuffDoc.h"
8#include "config.h" 7#include "config.h"
9#include "CDrawBuffer.h" 8#include "CDrawBuffer.h"
@@ -21,6 +20,7 @@
21#include "arrierego.h" 20#include "arrierego.h"
22#endif 21#endif
23#include "iSilo.h" 22#include "iSilo.h"
23#include "Reb.h"
24#endif 24#endif
25 25
26 26
@@ -60,6 +60,18 @@ void BuffDoc::locate(unsigned int n)
60 // //qDebug("BuffDoc:Located"); 60 // //qDebug("BuffDoc:Located");
61} 61}
62 62
63void BuffDoc::resetPos()
64{
65 // //qDebug("BuffDoc:locating:%u",n);
66 lastword.empty();
67 lastsizes[0] = laststartline = exp->locate();
68#ifdef NEWLINEBREAK
69 lastispara = false;
70#else
71 lastispara = false;
72#endif
73}
74
63static bool isletter(unsigned short c) 75static bool isletter(unsigned short c)
64{ 76{
65 if ('a' <= c && c <= 'z') return true; 77 if ('a' <= c && c <= 'z') return true;
@@ -635,6 +647,13 @@ int BuffDoc::openfile(QWidget* _parent, const char *src)
635 { 647 {
636 delete exp; 648 delete exp;
637 //qDebug("Trying ppms"); 649 //qDebug("Trying ppms");
650 exp = new CReb;
651 ret = exp->openfile(src);
652 }
653 if (ret != 0)
654 {
655 delete exp;
656 //qDebug("Trying ppms");
638 exp = new ppm_expander; 657 exp = new ppm_expander;
639 ret = exp->openfile(src); 658 ret = exp->openfile(src);
640 } 659 }
@@ -655,7 +674,17 @@ int BuffDoc::openfile(QWidget* _parent, const char *src)
655 } 674 }
656 // //qDebug("Doing final open:%x:%x",exp,filt); 675 // //qDebug("Doing final open:%x:%x",exp,filt);
657#else 676#else
658 QString codecpath(QTReaderUtil::getPluginPath()); 677#ifdef USEQPE
678#ifdef OPIE
679 QString codecpath(getenv("OPIEDIR"));
680#else
681 QString codecpath(getenv("QTDIR"));
682#endif
683 codecpath += "/plugins/reader/codecs";
684#else
685 QString codecpath(getenv("READERDIR"));
686 codecpath += "/codecs";
687#endif
659 QDir d(codecpath, "*.so"); 688 QDir d(codecpath, "*.so");
660 689
661 if (d.exists()) 690 if (d.exists())
@@ -706,3 +735,25 @@ QString BuffDoc::about()
706{ 735{
707 return QString("Buffered Decompressor (c) Tim Wentford\nHyphenation algorithm (c) Tim Wentford\n (Cyrillic support by Konstantin Isakov\n")+filt->about(); 736 return QString("Buffered Decompressor (c) Tim Wentford\nHyphenation algorithm (c) Tim Wentford\n (Cyrillic support by Konstantin Isakov\n")+filt->about();
708} 737}
738
739int BuffDoc::getsentence(CBuffer& buff)
740{
741 tchar ch;
742 int i = 0;
743 bool intext = false;
744 while ((ch = getch()) != 10 && ch != UEOF)
745 {
746 buff[i++] = ch;
747 if (ch == '"' || ch == '\'' || ch == 0x2018 || ch == 0x2019 ||
748 ch == 0x201a || ch == 0x201b || ch == 0x201c || ch == 0x201d)
749 {
750 intext = !intext;
751 }
752 if (!intext && (ch == '.' || ch == '!' || ch == '?')) break;
753 }
754
755 buff[i] = '\0';
756 if (i == 0 && ch == UEOF) i = -1;
757 laststartline = exp->locate();
758 return i;
759}