summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/BuffDoc.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-reader/BuffDoc.cpp') (more/less context) (show 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
@@ -5,3 +5,2 @@
-#include "usenef.h"
#include "BuffDoc.h"
@@ -23,2 +22,3 @@
#include "iSilo.h"
+#include "Reb.h"
#endif
@@ -62,2 +62,14 @@ void BuffDoc::locate(unsigned int n)
+void BuffDoc::resetPos()
+{
+ // //qDebug("BuffDoc:locating:%u",n);
+ lastword.empty();
+ lastsizes[0] = laststartline = exp->locate();
+#ifdef NEWLINEBREAK
+ lastispara = false;
+#else
+ lastispara = false;
+#endif
+}
+
static bool isletter(unsigned short c)
@@ -637,2 +649,9 @@ int BuffDoc::openfile(QWidget* _parent, const char *src)
//qDebug("Trying ppms");
+ exp = new CReb;
+ ret = exp->openfile(src);
+ }
+ if (ret != 0)
+ {
+ delete exp;
+ //qDebug("Trying ppms");
exp = new ppm_expander;
@@ -657,3 +676,13 @@ int BuffDoc::openfile(QWidget* _parent, const char *src)
#else
- QString codecpath(QTReaderUtil::getPluginPath());
+#ifdef USEQPE
+#ifdef OPIE
+ QString codecpath(getenv("OPIEDIR"));
+#else
+ QString codecpath(getenv("QTDIR"));
+#endif
+ codecpath += "/plugins/reader/codecs";
+#else
+ QString codecpath(getenv("READERDIR"));
+ codecpath += "/codecs";
+#endif
QDir d(codecpath, "*.so");
@@ -708 +737,23 @@ QString BuffDoc::about()
}
+
+int BuffDoc::getsentence(CBuffer& buff)
+{
+ tchar ch;
+ int i = 0;
+ bool intext = false;
+ while ((ch = getch()) != 10 && ch != UEOF)
+ {
+ buff[i++] = ch;
+ if (ch == '"' || ch == '\'' || ch == 0x2018 || ch == 0x2019 ||
+ ch == 0x201a || ch == 0x201b || ch == 0x201c || ch == 0x201d)
+ {
+ intext = !intext;
+ }
+ if (!intext && (ch == '.' || ch == '!' || ch == '?')) break;
+ }
+
+ buff[i] = '\0';
+ if (i == 0 && ch == UEOF) i = -1;
+ laststartline = exp->locate();
+ return i;
+}