Diffstat (limited to 'noncore/apps/opie-reader/BuffDoc.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/BuffDoc.cpp | 55 |
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 | |||
@@ -4,5 +4,4 @@ | |||
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" |
@@ -22,4 +21,5 @@ | |||
22 | #endif | 21 | #endif |
23 | #include "iSilo.h" | 22 | #include "iSilo.h" |
23 | #include "Reb.h" | ||
24 | #endif | 24 | #endif |
25 | 25 | ||
@@ -61,4 +61,16 @@ void BuffDoc::locate(unsigned int n) | |||
61 | } | 61 | } |
62 | 62 | ||
63 | void 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 | |||
63 | static bool isletter(unsigned short c) | 75 | static bool isletter(unsigned short c) |
64 | { | 76 | { |
@@ -636,4 +648,11 @@ int BuffDoc::openfile(QWidget* _parent, const char *src) | |||
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); |
@@ -656,5 +675,15 @@ int BuffDoc::openfile(QWidget* _parent, const char *src) | |||
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 | ||
@@ -707,2 +736,24 @@ QString BuffDoc::about() | |||
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 | |||
739 | int 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 | } | ||