summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-09-14 02:39:44 (UTC)
committer llornkcor <llornkcor>2002-09-14 02:39:44 (UTC)
commit2f55be65436cb05a8580f4a436f94bce9de48da7 (patch) (unidiff)
tree5edbb3683681bd14f263a6b7fe259dbcffa51f22
parent2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975 (diff)
downloadopie-2f55be65436cb05a8580f4a436f94bce9de48da7.zip
opie-2f55be65436cb05a8580f4a436f94bce9de48da7.tar.gz
opie-2f55be65436cb05a8580f4a436f94bce9de48da7.tar.bz2
opie specific resource change and messagbox caption to opiereader
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/Bkmks.cpp182
-rw-r--r--noncore/apps/opie-reader/BuffDoc.cpp86
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.cpp942
3 files changed, 605 insertions, 605 deletions
diff --git a/noncore/apps/opie-reader/Bkmks.cpp b/noncore/apps/opie-reader/Bkmks.cpp
index 92ed69f..0cb9ea9 100644
--- a/noncore/apps/opie-reader/Bkmks.cpp
+++ b/noncore/apps/opie-reader/Bkmks.cpp
@@ -18,14 +18,14 @@ Bkmk::Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p) : m_position(_
18 18
19 if (_anno == NULL) 19 if (_anno == NULL)
20 { 20 {
21 m_anno = new tchar[1]; 21 m_anno = new tchar[1];
22 m_anno[0] = 0; 22 m_anno[0] = 0;
23 } 23 }
24 else 24 else
25 { 25 {
26 len = ustrlen(_anno)+1; 26 len = ustrlen(_anno)+1;
27 m_anno = new tchar[len]; 27 m_anno = new tchar[len];
28 for (int i = 0; i < len; i++) m_anno[i] = _anno[i]; 28 for (int i = 0; i < len; i++) m_anno[i] = _anno[i];
29 } 29 }
30} 30}
31 31
@@ -41,30 +41,30 @@ Bkmk& Bkmk::operator=(const Bkmk& rhs)
41{ 41{
42 if (m_name != NULL) 42 if (m_name != NULL)
43 { 43 {
44 delete [] m_name; 44 delete [] m_name;
45 m_name = NULL; 45 m_name = NULL;
46 } 46 }
47 if (m_anno != NULL) 47 if (m_anno != NULL)
48 { 48 {
49 delete [] m_anno; 49 delete [] m_anno;
50 m_anno = NULL; 50 m_anno = NULL;
51 } 51 }
52 if (rhs.m_name != NULL) 52 if (rhs.m_name != NULL)
53 { 53 {
54 int len = ustrlen(rhs.m_name)+1; 54 int len = ustrlen(rhs.m_name)+1;
55 m_name = new tchar[len]; 55 m_name = new tchar[len];
56 for (int i = 0; i < len; i++) m_name[i] = rhs.m_name[i]; 56 for (int i = 0; i < len; i++) m_name[i] = rhs.m_name[i];
57 } 57 }
58 else 58 else
59 m_name = NULL; 59 m_name = NULL;
60 if (rhs.m_anno != NULL) 60 if (rhs.m_anno != NULL)
61 { 61 {
62 int len = ustrlen(rhs.m_anno)+1; 62 int len = ustrlen(rhs.m_anno)+1;
63 m_anno = new tchar[len]; 63 m_anno = new tchar[len];
64 for (int i = 0; i < len; i++) m_anno[i] = rhs.m_anno[i]; 64 for (int i = 0; i < len; i++) m_anno[i] = rhs.m_anno[i];
65 } 65 }
66 else 66 else
67 m_anno = NULL; 67 m_anno = NULL;
68 m_position = rhs.m_position; 68 m_position = rhs.m_position;
69 return *this; 69 return *this;
70} 70}
@@ -78,17 +78,17 @@ void Bkmk::setAnno(tchar* t)
78{ 78{
79 if (m_anno != NULL) 79 if (m_anno != NULL)
80 { 80 {
81 delete [] m_anno; 81 delete [] m_anno;
82 m_anno = NULL; 82 m_anno = NULL;
83 } 83 }
84 if (t != NULL) 84 if (t != NULL)
85 { 85 {
86 int len = ustrlen(t)+1; 86 int len = ustrlen(t)+1;
87 m_anno = new tchar[len]; 87 m_anno = new tchar[len];
88 for (int i = 0; i < len; i++) m_anno[i] = t[i]; 88 for (int i = 0; i < len; i++) m_anno[i] = t[i];
89 } 89 }
90 else 90 else
91 m_anno = NULL; 91 m_anno = NULL;
92} 92}
93 93
94BkmkFile::BkmkFile(const char *fnm, bool w = false) 94BkmkFile::BkmkFile(const char *fnm, bool w = false)
@@ -97,11 +97,11 @@ BkmkFile::BkmkFile(const char *fnm, bool w = false)
97{ 97{
98 if (w) 98 if (w)
99 { 99 {
100 f = fopen(fnm, "wb"); 100 f = fopen(fnm, "wb");
101 } 101 }
102 else 102 else
103 { 103 {
104 f = fopen(fnm, "rb"); 104 f = fopen(fnm, "rb");
105 } 105 }
106} 106}
107 107
@@ -114,13 +114,13 @@ void BkmkFile::write(tchar* nm, tchar* an, const unsigned int& pos)
114{ 114{
115 if (f != NULL) 115 if (f != NULL)
116 { 116 {
117 unsigned short ln = ustrlen(nm); 117 unsigned short ln = ustrlen(nm);
118 fwrite(&ln,sizeof(ln),1,f); 118 fwrite(&ln,sizeof(ln),1,f);
119 fwrite(nm,sizeof(tchar),ln,f); 119 fwrite(nm,sizeof(tchar),ln,f);
120 ln = ustrlen(an); 120 ln = ustrlen(an);
121 fwrite(&ln,sizeof(ln),1,f); 121 fwrite(&ln,sizeof(ln),1,f);
122 if (ln > 0) fwrite(an,sizeof(tchar),ln,f); 122 if (ln > 0) fwrite(an,sizeof(tchar),ln,f);
123 fwrite(&pos,sizeof(pos),1,f); 123 fwrite(&pos,sizeof(pos),1,f);
124 } 124 }
125} 125}
126 126
@@ -130,11 +130,11 @@ void BkmkFile::write(CList<Bkmk>& bl)
130{ 130{
131 if (f != NULL) 131 if (f != NULL)
132 { 132 {
133 fwrite(&magic, sizeof(magic), 1, f); 133 fwrite(&magic, sizeof(magic), 1, f);
134 for (CList<Bkmk>::iterator i = bl.begin(); i != bl.end(); i++) 134 for (CList<Bkmk>::iterator i = bl.begin(); i != bl.end(); i++)
135 { 135 {
136 write(*i); 136 write(*i);
137 } 137 }
138 } 138 }
139} 139}
140 140
@@ -143,20 +143,20 @@ Bkmk* BkmkFile::read()
143 Bkmk* b = NULL; 143 Bkmk* b = NULL;
144 if (f != NULL) 144 if (f != NULL)
145 { 145 {
146 unsigned short ln; 146 unsigned short ln;
147 if (fread(&ln,sizeof(ln),1,f) == 1) 147 if (fread(&ln,sizeof(ln),1,f) == 1)
148 { 148 {
149 b = new Bkmk; 149 b = new Bkmk;
150 b->m_name = new tchar[ln+1]; 150 b->m_name = new tchar[ln+1];
151 fread(b->m_name,sizeof(tchar),ln,f); 151 fread(b->m_name,sizeof(tchar),ln,f);
152 b->m_name[ln] = 0; 152 b->m_name[ln] = 0;
153 153
154 fread(&ln,sizeof(ln),1,f); 154 fread(&ln,sizeof(ln),1,f);
155 b->m_anno = new tchar[ln+1]; 155 b->m_anno = new tchar[ln+1];
156 if (ln > 0) fread(b->m_anno,sizeof(tchar),ln,f); 156 if (ln > 0) fread(b->m_anno,sizeof(tchar),ln,f);
157 b->m_anno[ln] = 0; 157 b->m_anno[ln] = 0;
158 fread(&b->m_position,sizeof(b->m_position),1,f); 158 fread(&b->m_position,sizeof(b->m_position),1,f);
159 } 159 }
160 } 160 }
161 return b; 161 return b;
162} 162}
@@ -166,26 +166,26 @@ CList<Bkmk>* BkmkFile::readall()
166 CList<Bkmk>* bl = NULL; 166 CList<Bkmk>* bl = NULL;
167 if (f != NULL) 167 if (f != NULL)
168 { 168 {
169 unsigned long newmagic; 169 unsigned long newmagic;
170 fread(&newmagic, sizeof(newmagic), 1, f); 170 fread(&newmagic, sizeof(newmagic), 1, f);
171 if (newmagic != magic) 171 if (newmagic != magic)
172 { 172 {
173 if (QMessageBox::warning(NULL, "Old bookmark file!", "Which version of QTReader\ndid you upgrade from?", "0_4*", "Any other version") == 0) 173 if (QMessageBox::warning(NULL, "Old bookmark file!", "Which version of OpieReader\ndid you upgrade from?", "0_4*", "Any other version") == 0)
174 { 174 {
175 fseek(f,0,SEEK_SET); 175 fseek(f,0,SEEK_SET);
176 bl = readall04(); 176 bl = readall04();
177 } 177 }
178 else 178 else
179 { 179 {
180 fseek(f,0,SEEK_SET); 180 fseek(f,0,SEEK_SET);
181 bl = readall03(); 181 bl = readall03();
182 } 182 }
183 isUpgraded = true; 183 isUpgraded = true;
184 } 184 }
185 else 185 else
186 { 186 {
187 bl = readall04(); 187 bl = readall04();
188 } 188 }
189 } 189 }
190 return bl; 190 return bl;
191} 191}
@@ -195,10 +195,10 @@ CList<Bkmk>* BkmkFile::readall04()
195 CList<Bkmk>* bl = new CList<Bkmk>; 195 CList<Bkmk>* bl = new CList<Bkmk>;
196 while (1) 196 while (1)
197 { 197 {
198 Bkmk* b = read(); 198 Bkmk* b = read();
199 if (b == NULL) break; 199 if (b == NULL) break;
200 bl->push_back(*b); 200 bl->push_back(*b);
201 delete b; 201 delete b;
202 } 202 }
203 return bl; 203 return bl;
204} 204}
@@ -208,10 +208,10 @@ CList<Bkmk>* BkmkFile::readall03()
208 CList<Bkmk>* bl = new CList<Bkmk>; 208 CList<Bkmk>* bl = new CList<Bkmk>;
209 while (1) 209 while (1)
210 { 210 {
211 Bkmk* b = read03(); 211 Bkmk* b = read03();
212 if (b == NULL) break; 212 if (b == NULL) break;
213 bl->push_back(*b); 213 bl->push_back(*b);
214 delete b; 214 delete b;
215 } 215 }
216 return bl; 216 return bl;
217} 217}
@@ -221,20 +221,20 @@ Bkmk* BkmkFile::read03()
221 Bkmk* b = NULL; 221 Bkmk* b = NULL;
222 if (f != NULL) 222 if (f != NULL)
223 { 223 {
224 unsigned short ln; 224 unsigned short ln;
225 if (fread(&ln,sizeof(ln),1,f) == 1) 225 if (fread(&ln,sizeof(ln),1,f) == 1)
226 { 226 {
227 b = new Bkmk; 227 b = new Bkmk;
228 b->m_name = new tchar[ln+1]; 228 b->m_name = new tchar[ln+1];
229 fread(b->m_name,sizeof(tchar),ln,f); 229 fread(b->m_name,sizeof(tchar),ln,f);
230 b->m_name[ln] = 0; 230 b->m_name[ln] = 0;
231 231
232 ln = 0; 232 ln = 0;
233 b->m_anno = new tchar[ln+1]; 233 b->m_anno = new tchar[ln+1];
234 b->m_anno[ln] = 0; 234 b->m_anno[ln] = 0;
235 235
236 fread(&b->m_position,sizeof(b->m_position),1,f); 236 fread(&b->m_position,sizeof(b->m_position),1,f);
237 } 237 }
238 } 238 }
239 return b; 239 return b;
240} 240}
diff --git a/noncore/apps/opie-reader/BuffDoc.cpp b/noncore/apps/opie-reader/BuffDoc.cpp
index e37b136..d4541ea 100644
--- a/noncore/apps/opie-reader/BuffDoc.cpp
+++ b/noncore/apps/opie-reader/BuffDoc.cpp
@@ -13,8 +13,8 @@ bool BuffDoc::hyperlink(unsigned int n)
13 lastispara = false; 13 lastispara = false;
14 if (exp != NULL) 14 if (exp != NULL)
15 { 15 {
16 bRet = exp->hyperlink(n); 16 bRet = exp->hyperlink(n);
17 lastsizes[0] = laststartline = exp->locate(); 17 lastsizes[0] = laststartline = exp->locate();
18 } 18 }
19 return bRet; 19 return bRet;
20} 20}
@@ -37,9 +37,9 @@ bool BuffDoc::getline(CDrawBuffer* buff, int w)
37 buff->empty(); 37 buff->empty();
38 if (exp == NULL) 38 if (exp == NULL)
39 { 39 {
40 //(*buff)[0] = '\0'; 40// (*buff)[0] = '\0';
41 buff->empty(); 41 buff->empty();
42 return false; 42 return false;
43 } 43 }
44 int len = 0, lastcheck = 0; 44 int len = 0, lastcheck = 0;
45 if (lastword.length() > 0) 45 if (lastword.length() > 0)
@@ -54,9 +54,9 @@ bool BuffDoc::getline(CDrawBuffer* buff, int w)
54 if (slen > w) 54 if (slen > w)
55 { 55 {
56 for ( ; len > 0; len--) 56 for ( ; len > 0; len--)
57 { 57 {
58 if (buff->width(len) < w) break; 58 if (buff->width(len) < w) break;
59 } 59 }
60// lastword = buff->data() + len - 1; 60// lastword = buff->data() + len - 1;
61 laststartline = lastsizes[len-1]; 61 laststartline = lastsizes[len-1];
62 lastword.setright(*buff, len - 1); 62 lastword.setright(*buff, len - 1);
@@ -88,10 +88,10 @@ bool BuffDoc::getline(CDrawBuffer* buff, int w)
88 getch(ch, cs); 88 getch(ch, cs);
89 while (ch != ' ' && ch != '\012' && ch != UEOF && len < 128) 89 while (ch != ' ' && ch != '\012' && ch != UEOF && len < 128)
90 { 90 {
91 len++; 91 len++;
92 buff->addch(ch,cs); 92 buff->addch(ch,cs);
93 allsizes[len] = exp->locate(); 93 allsizes[len] = exp->locate();
94 getch(ch, cs); 94 getch(ch, cs);
95 } 95 }
96 (*buff)[len] = 0; 96 (*buff)[len] = 0;
97 slen = buff->width(len); 97 slen = buff->width(len);
@@ -100,8 +100,8 @@ bool BuffDoc::getline(CDrawBuffer* buff, int w)
100 allsizes[len] = exp->locate(); 100 allsizes[len] = exp->locate();
101 if (slen < w && ch != ' ') 101 if (slen < w && ch != ' ')
102 { 102 {
103 lastcheck = len; 103 lastcheck = len;
104 break; 104 break;
105 } 105 }
106 lastispara = (ch == '\012'); 106 lastispara = (ch == '\012');
107 } 107 }
@@ -130,17 +130,17 @@ bool BuffDoc::getline(CDrawBuffer* buff, int w, int cw)
130 buff->empty(); 130 buff->empty();
131 if (exp == NULL) 131 if (exp == NULL)
132 { 132 {
133 return false; 133 return false;
134 } 134 }
135 tchar ch; 135 tchar ch;
136 CStyle cs; 136 CStyle cs;
137 int i = 0; 137 int i = 0;
138 while (i*cw < w) 138 while (i*cw < w)
139 { 139 {
140 getch(ch, cs); 140 getch(ch, cs);
141 if (ch == '\12' || ch == UEOF) break; 141 if (ch == '\12' || ch == UEOF) break;
142 buff->addch(ch,cs); 142 buff->addch(ch,cs);
143 i++; 143 i++;
144 } 144 }
145 buff->truncate(i); 145 buff->truncate(i);
146 laststartline = exp->locate(); 146 laststartline = exp->locate();
@@ -164,53 +164,53 @@ int BuffDoc::openfile(QWidget* _parent, const char *src)
164 int ret = exp->openfile(src); 164 int ret = exp->openfile(src);
165 if (ret == -1) 165 if (ret == -1)
166 { 166 {
167 delete exp; 167 delete exp;
168 exp = NULL; 168 exp = NULL;
169 return ret; 169 return ret;
170 } 170 }
171 if (ret == -2) 171 if (ret == -2)
172 { 172 {
173 173
174 delete exp; 174 delete exp;
175 exp = new ztxt; 175 exp = new ztxt;
176 ret = exp->openfile(src); 176 ret = exp->openfile(src);
177 } 177 }
178 if (ret != 0) 178 if (ret != 0)
179 { 179 {
180 180
181 delete exp; 181 delete exp;
182 exp = new CPlucker; 182 exp = new CPlucker;
183 ret = exp->openfile(src); 183 ret = exp->openfile(src);
184 } 184 }
185#ifndef SMALL 185#ifndef SMALL
186 if (ret != 0) 186 if (ret != 0)
187 { 187 {
188 delete exp; 188 delete exp;
189 qDebug("Trying ppms"); 189 qDebug("Trying ppms");
190 exp = new ppm_expander; 190 exp = new ppm_expander;
191 ret = exp->openfile(src); 191 ret = exp->openfile(src);
192 } 192 }
193 193
194 if (ret != 0) 194 if (ret != 0)
195 { 195 {
196 delete exp; 196 delete exp;
197 exp = new Text; 197 exp = new Text;
198 // qDebug("Trying text"); 198// qDebug("Trying text");
199 ret = exp->openfile(src); 199 ret = exp->openfile(src);
200 } 200 }
201#else 201#else
202 if (ret != 0) 202 if (ret != 0)
203 { 203 {
204 delete exp; 204 delete exp;
205 exp = new Text; 205 exp = new Text;
206 ret = exp->openfile(src); 206 ret = exp->openfile(src);
207 } 207 }
208#endif 208#endif
209 if (ret != 0) 209 if (ret != 0)
210 { 210 {
211 delete exp; 211 delete exp;
212 QMessageBox::information(_parent, "QTReader", "Unknown file compression type","Try another file"); 212 QMessageBox::information(_parent, "OpieReader", "Unknown file compression type","Try another file");
213 return ret; 213 return ret;
214 } 214 }
215 // qDebug("Doing final open:%x:%x",exp,filt); 215 // qDebug("Doing final open:%x:%x",exp,filt);
216 216
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp
index 0608b66..ef1f4f1 100644
--- a/noncore/apps/opie-reader/QTReaderApp.cpp
+++ b/noncore/apps/opie-reader/QTReaderApp.cpp
@@ -74,16 +74,16 @@ void QTReaderApp::listBkmkFiles()
74 74
75 while(1) 75 while(1)
76 { 76 {
77 struct dirent* de; 77 struct dirent* de;
78 struct stat buf; 78 struct stat buf;
79 de = readdir(d); 79 de = readdir(d);
80 if (de == NULL) break; 80 if (de == NULL) break;
81 81
82 if (lstat((const char *)Global::applicationFileName("uqtreader",de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) 82 if (lstat((const char *)Global::applicationFileName("uqtreader",de->d_name),&buf) == 0 && S_ISREG(buf.st_mode))
83 { 83 {
84 bkmkselector->insertItem(de->d_name); 84 bkmkselector->insertItem(de->d_name);
85 cnt++; 85 cnt++;
86 } 86 }
87 } 87 }
88 88
89 closedir(d); 89 closedir(d);
@@ -95,11 +95,11 @@ void QTReaderApp::listBkmkFiles()
95 if (m_fontVisible) m_fontBar->hide(); 95 if (m_fontVisible) m_fontBar->hide();
96 if (regVisible) regBar->hide(); 96 if (regVisible) regBar->hide();
97 if (searchVisible) searchBar->hide(); 97 if (searchVisible) searchBar->hide();
98 m_nRegAction = cRmBkmkFile; 98 m_nRegAction = cRmBkmkFile;
99 editorStack->raiseWidget( bkmkselector ); 99 editorStack->raiseWidget( bkmkselector );
100 } 100 }
101 else 101 else
102 QMessageBox::information(this, "QTReader", "No bookmark files"); 102 QMessageBox::information(this, "OpieReader", "No bookmark files");
103} 103}
104 104
105QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) 105QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
@@ -111,14 +111,14 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
111 pBkmklist = NULL; 111 pBkmklist = NULL;
112 doc = 0; 112 doc = 0;
113 113
114 m_fBkmksChanged = false; 114 m_fBkmksChanged = false;
115 115
116 QString lang = getenv( "LANG" ); 116 QString lang = getenv( "LANG" );
117 117
118 m_autogenstr = "^ *[A-Z].*[a-z] *$"; 118 m_autogenstr = "^ *[A-Z].*[a-z] *$";
119 setToolBarsMovable( FALSE ); 119 setToolBarsMovable( FALSE );
120 120
121 setIcon( Resource::loadPixmap( "uqtreader" ) ); 121 setIcon( Resource::loadPixmap( "opie-reader/uqtreader" ) );
122 122
123 QPEToolBar *bar = new QPEToolBar( this ); 123 QPEToolBar *bar = new QPEToolBar( this );
124 bar->setHorizontalStretchable( TRUE ); 124 bar->setHorizontalStretchable( TRUE );
@@ -255,7 +255,7 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
255 connect(ag, SIGNAL( selected(QAction*) ), this, SLOT( buttonActionSelected(QAction*) ) ); 255 connect(ag, SIGNAL( selected(QAction*) ), this, SLOT( buttonActionSelected(QAction*) ) );
256 256
257 257
258 a = m_scrollButton = new QAction( tr( "Scroll" ), Resource::loadPixmap( "panel-arrow-down" ), QString::null, 0, this, 0, true ); 258 a = m_scrollButton = new QAction( tr( "Scroll" ), Resource::loadPixmap( "opie-reader/panel-arrow-down" ), QString::null, 0, this, 0, true );
259// connect( a, SIGNAL( activated() ), this, SLOT( autoScroll() ) ); 259// connect( a, SIGNAL( activated() ), this, SLOT( autoScroll() ) );
260 a->setOn(false); 260 a->setOn(false);
261 connect( a, SIGNAL( toggled(bool) ), this, SLOT( autoScroll(bool) ) ); 261 connect( a, SIGNAL( toggled(bool) ), this, SLOT( autoScroll(bool) ) );
@@ -537,10 +537,10 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
537 537
538#ifdef __ISEARCH 538#ifdef __ISEARCH
539 connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 539 connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
540 this, SLOT( search( const QString& ) ) ); 540 this, SLOT( search( const QString& ) ) );
541#else 541#else
542 connect( searchEdit, SIGNAL( returnPressed( ) ), 542 connect( searchEdit, SIGNAL( returnPressed( ) ),
543 this, SLOT( search( ) ) ); 543 this, SLOT( search( ) ) );
544#endif 544#endif
545 a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); 545 a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 );
546 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); 546 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) );
@@ -563,7 +563,7 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
563 regBar->setStretchableWidget( regEdit ); 563 regBar->setStretchableWidget( regEdit );
564 564
565 connect( regEdit, SIGNAL( returnPressed( ) ), 565 connect( regEdit, SIGNAL( returnPressed( ) ),
566 this, SLOT( do_regaction() ) ); 566 this, SLOT( do_regaction() ) );
567 567
568 a = new QAction( tr( "Do Reg" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); 568 a = new QAction( tr( "Do Reg" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 );
569 connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) ); 569 connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) );
@@ -582,37 +582,37 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
582 m_fontSelector = new QComboBox(false, m_fontBar); 582 m_fontSelector = new QComboBox(false, m_fontBar);
583 m_fontBar->setStretchableWidget( m_fontSelector ); 583 m_fontBar->setStretchableWidget( m_fontSelector );
584 { 584 {
585 FontDatabase f; 585 FontDatabase f;
586 QStringList flist = f.families(); 586 QStringList flist = f.families();
587 m_fontSelector->insertStringList(flist); 587 m_fontSelector->insertStringList(flist);
588 588
589 bool realfont = false; 589 bool realfont = false;
590 for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) 590 for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++)
591 { 591 {
592 if (reader->m_fontname == *nm) 592 if (reader->m_fontname == *nm)
593 { 593 {
594 realfont = true; 594 realfont = true;
595 break; 595 break;
596 } 596 }
597 } 597 }
598 if (!realfont) reader->m_fontname = flist[0]; 598 if (!realfont) reader->m_fontname = flist[0];
599 } // delete the FontDatabase!!! 599 } // delete the FontDatabase!!!
600 600
601 connect( m_fontSelector, SIGNAL( activated(const QString& ) ), 601 connect( m_fontSelector, SIGNAL( activated(const QString& ) ),
602 this, SLOT( do_setfont(const QString&) ) ); 602 this, SLOT( do_setfont(const QString&) ) );
603 603
604 m_fontBar->hide(); 604 m_fontBar->hide();
605 m_fontVisible = false; 605 m_fontVisible = false;
606 606
607 connect(qApp, SIGNAL( appMessage(const QCString&, const QByteArray& ) ), 607 connect(qApp, SIGNAL( appMessage(const QCString&, const QByteArray& ) ),
608 this, SLOT( msgHandler(const QCString&, const QByteArray&) ) ); 608 this, SLOT( msgHandler(const QCString&, const QByteArray&) ) );
609 609
610 610
611 reader->init(); 611 reader->init();
612 if (!reader->m_lastfile.isEmpty()) 612 if (!reader->m_lastfile.isEmpty())
613 { 613 {
614 openFile( reader->m_lastfile ); 614 openFile( reader->m_lastfile );
615 doc = new DocLnk(reader->m_lastfile); 615 doc = new DocLnk(reader->m_lastfile);
616 } 616 }
617 m_EncodingAction[reader->m_encd]->setOn(true); 617 m_EncodingAction[reader->m_encd]->setOn(true);
618 m_buttonAction[m_spaceTarget]->setOn(true); 618 m_buttonAction[m_spaceTarget]->setOn(true);
@@ -628,242 +628,242 @@ void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data)
628 QDataStream stream( _data, IO_ReadOnly ); 628 QDataStream stream( _data, IO_ReadOnly );
629 if ( msg == "info(QString)" ) 629 if ( msg == "info(QString)" )
630 { 630 {
631 QString info; 631 QString info;
632 stream >> info; 632 stream >> info;
633 QMessageBox::information(this, "QTReader", info); 633 QMessageBox::information(this, "OpieReader", info);
634 } 634 }
635 else if ( msg == "warn(QString)" ) 635 else if ( msg == "warn(QString)" )
636 { 636 {
637 QString info; 637 QString info;
638 stream >> info; 638 stream >> info;
639 QMessageBox::warning(this, "QTReader", info); 639 QMessageBox::warning(this, "OpieReader", info);
640 } 640 }
641 641
642 642
643 else if ( msg == "exit()" ) 643 else if ( msg == "exit()" )
644 { 644 {
645 m_dontSave = true; 645 m_dontSave = true;
646 close(); 646 close();
647 } 647 }
648 else if ( msg == "pageDown()" ) 648 else if ( msg == "pageDown()" )
649 { 649 {
650 reader->dopagedn(); 650 reader->dopagedn();
651 } 651 }
652 else if ( msg == "pageUp()" ) 652 else if ( msg == "pageUp()" )
653 { 653 {
654 reader->dopageup(); 654 reader->dopageup();
655 } 655 }
656 else if ( msg == "lineDown()" ) 656 else if ( msg == "lineDown()" )
657 { 657 {
658 reader->lineDown(); 658 reader->lineDown();
659 } 659 }
660 else if ( msg == "lineUp()" ) 660 else if ( msg == "lineUp()" )
661 { 661 {
662 reader->lineUp(); 662 reader->lineUp();
663 } 663 }
664 else if ( msg == "showText()" ) 664 else if ( msg == "showText()" )
665 { 665 {
666 showEditTools(); 666 showEditTools();
667 } 667 }
668 else if ( msg == "File/Open(QString)" ) 668 else if ( msg == "File/Open(QString)" )
669 { 669 {
670 QString info; 670 QString info;
671 stream >> info; 671 stream >> info;
672 openFile( info ); 672 openFile( info );
673 } 673 }
674 else if ( msg == "File/Info()" ) 674 else if ( msg == "File/Info()" )
675 { 675 {
676 showinfo(); 676 showinfo();
677 } 677 }
678 else if ( msg == "File/Start Block()" ) 678 else if ( msg == "File/Start Block()" )
679 { 679 {
680 editMark(); 680 editMark();
681 } 681 }
682 else if ( msg == "File/Copy Block()" ) 682 else if ( msg == "File/Copy Block()" )
683 { 683 {
684 editCopy(); 684 editCopy();
685 } 685 }
686 else if ( msg == "File/Scroll(int)" ) 686 else if ( msg == "File/Scroll(int)" )
687 { 687 {
688 int info; 688 int info;
689 stream >> info; 689 stream >> info;
690 autoScroll(info); 690 autoScroll(info);
691 } 691 }
692 else if ( msg == "File/Jump(int)" ) 692 else if ( msg == "File/Jump(int)" )
693 { 693 {
694 int info; 694 int info;
695 stream >> info; 695 stream >> info;
696 reader->locate(info); 696 reader->locate(info);
697 } 697 }
698 else if ( msg == "File/Page/Line Scroll(int)" ) 698 else if ( msg == "File/Page/Line Scroll(int)" )
699 { 699 {
700 int info; 700 int info;
701 stream >> info; 701 stream >> info;
702 pagemode(info); 702 pagemode(info);
703 } 703 }
704 else if ( msg == "File/Set Overlap(int)" ) 704 else if ( msg == "File/Set Overlap(int)" )
705 { 705 {
706 int info; 706 int info;
707 stream >> info; 707 stream >> info;
708 reader->m_overlap = info; 708 reader->m_overlap = info;
709 } 709 }
710 else if ( msg == "File/Set Dictionary(QString)" ) 710 else if ( msg == "File/Set Dictionary(QString)" )
711 { 711 {
712 QString info; 712 QString info;
713 stream >> info; 713 stream >> info;
714 do_settarget(info); 714 do_settarget(info);
715 } 715 }
716 else if ( msg == "File/Two/One Touch(int)" ) 716 else if ( msg == "File/Two/One Touch(int)" )
717 { 717 {
718 int info; 718 int info;
719 stream >> info; 719 stream >> info;
720 setTwoTouch(info); 720 setTwoTouch(info);
721 } 721 }
722 else if ( msg == "Target/Annotation(int)" ) 722 else if ( msg == "Target/Annotation(int)" )
723 { 723 {
724 int info; 724 int info;
725 stream >> info; 725 stream >> info;
726 OnAnnotation(info); 726 OnAnnotation(info);
727 } 727 }
728 else if ( msg == "Target/Dictionary(int)" ) 728 else if ( msg == "Target/Dictionary(int)" )
729 { 729 {
730 int info; 730 int info;
731 stream >> info; 731 stream >> info;
732 OnDictionary(info); 732 OnDictionary(info);
733 } 733 }
734 else if ( msg == "Target/Clipboard(int)" ) 734 else if ( msg == "Target/Clipboard(int)" )
735 { 735 {
736 int info; 736 int info;
737 stream >> info; 737 stream >> info;
738 OnClipboard(info); 738 OnClipboard(info);
739 } 739 }
740 else if ( msg == "File/Find(QString)" ) 740 else if ( msg == "File/Find(QString)" )
741 { 741 {
742 QString info; 742 QString info;
743 stream >> info; 743 stream >> info;
744 QRegExp arg(info); 744 QRegExp arg(info);
745 size_t pos = reader->pagelocate(); 745 size_t pos = reader->pagelocate();
746 size_t start = pos; 746 size_t start = pos;
747 CDrawBuffer test(&(reader->m_fontControl)); 747 CDrawBuffer test(&(reader->m_fontControl));
748 reader->buffdoc.getline(&test,reader->width()); 748 reader->buffdoc.getline(&test,reader->width());
749 while (arg.match(toQString(test.data())) == -1) 749 while (arg.match(toQString(test.data())) == -1)
750 { 750 {
751 pos = reader->locate(); 751 pos = reader->locate();
752 if (!reader->buffdoc.getline(&test,reader->width())) 752 if (!reader->buffdoc.getline(&test,reader->width()))
753 { 753 {
754 QMessageBox::information(this, "QTReader", QString("Can't find\n")+info); 754 QMessageBox::information(this, "OpieReader", QString("Can't find\n")+info);
755 pos = start; 755 pos = start;
756 break; 756 break;
757 } 757 }
758 } 758 }
759 reader->locate(pos); 759 reader->locate(pos);
760 } 760 }
761 else if ( msg == "Layout/Strip CR(int)" ) 761 else if ( msg == "Layout/Strip CR(int)" )
762 { 762 {
763 int info; 763 int info;
764 stream >> info; 764 stream >> info;
765 stripcr(info); 765 stripcr(info);
766 } 766 }
767 else if ( msg == "Markup/Auto(int)" ) 767 else if ( msg == "Markup/Auto(int)" )
768 { 768 {
769 int info; 769 int info;
770 stream >> info; 770 stream >> info;
771 autofmt(info); 771 autofmt(info);
772 } 772 }
773 else if ( msg == "Markup/Text(int)" ) 773 else if ( msg == "Markup/Text(int)" )
774 { 774 {
775 int info; 775 int info;
776 stream >> info; 776 stream >> info;
777 textfmt(info); 777 textfmt(info);
778 } 778 }
779 else if ( msg == "Markup/HTML(int)" ) 779 else if ( msg == "Markup/HTML(int)" )
780 { 780 {
781 int info; 781 int info;
782 stream >> info; 782 stream >> info;
783 striphtml(info); 783 striphtml(info);
784 } 784 }
785 else if ( msg == "Markup/Peanut(int)" ) 785 else if ( msg == "Markup/Peanut(int)" )
786 { 786 {
787 int info; 787 int info;
788 stream >> info; 788 stream >> info;
789 peanut(info); 789 peanut(info);
790 } 790 }
791 else if ( msg == "Layout/Dehyphen(int)" ) 791 else if ( msg == "Layout/Dehyphen(int)" )
792 { 792 {
793 int info; 793 int info;
794 stream >> info; 794 stream >> info;
795 dehyphen(info); 795 dehyphen(info);
796 } 796 }
797 else if ( msg == "Layout/Unindent(int)" ) 797 else if ( msg == "Layout/Unindent(int)" )
798 { 798 {
799 int info; 799 int info;
800 stream >> info; 800 stream >> info;
801 unindent(info); 801 unindent(info);
802 } 802 }
803 else if ( msg == "Layout/Re-paragraph(int)" ) 803 else if ( msg == "Layout/Re-paragraph(int)" )
804 { 804 {
805 int info; 805 int info;
806 stream >> info; 806 stream >> info;
807 repara(info); 807 repara(info);
808 } 808 }
809 else if ( msg == "Layout/Double Space(int)" ) 809 else if ( msg == "Layout/Double Space(int)" )
810 { 810 {
811 int info; 811 int info;
812 stream >> info; 812 stream >> info;
813 dblspce(info); 813 dblspce(info);
814 } 814 }
815 else if ( msg == "Layout/Indent(int)" ) 815 else if ( msg == "Layout/Indent(int)" )
816 { 816 {
817 int info; 817 int info;
818 stream >> info; 818 stream >> info;
819 reader->bindenter = info; 819 reader->bindenter = info;
820 reader->setfilter(reader->getfilter()); 820 reader->setfilter(reader->getfilter());
821 } 821 }
822 else if ( msg == "Layout/Remap(int)" ) 822 else if ( msg == "Layout/Remap(int)" )
823 { 823 {
824 int info; 824 int info;
825 stream >> info; 825 stream >> info;
826 remap(info); 826 remap(info);
827 } 827 }
828 else if ( msg == "Layout/Embolden(int)" ) 828 else if ( msg == "Layout/Embolden(int)" )
829 { 829 {
830 int info; 830 int info;
831 stream >> info; 831 stream >> info;
832 embolden(info); 832 embolden(info);
833 } 833 }
834 else if ( msg == "Format/Ideogram/Word(int)" ) 834 else if ( msg == "Format/Ideogram/Word(int)" )
835 { 835 {
836 int info; 836 int info;
837 stream >> info; 837 stream >> info;
838 monospace(info); 838 monospace(info);
839 } 839 }
840 else if ( msg == "Format/Set width(int)" ) 840 else if ( msg == "Format/Set width(int)" )
841 { 841 {
842 int info; 842 int info;
843 stream >> info; 843 stream >> info;
844 reader->m_charpc = info; 844 reader->m_charpc = info;
845 reader->setfont(); 845 reader->setfont();
846 reader->refresh(); 846 reader->refresh();
847 } 847 }
848 else if ( msg == "Format/Encoding(QString)" ) 848 else if ( msg == "Format/Encoding(QString)" )
849 { 849 {
850 QString info; 850 QString info;
851 stream >> info; 851 stream >> info;
852 reader->setencoding(EncNameToInt(info)); 852 reader->setencoding(EncNameToInt(info));
853 } 853 }
854 else if ( msg == "Format/Set Font(QString,int)" ) 854 else if ( msg == "Format/Set Font(QString,int)" )
855 { 855 {
856 QString fontname; 856 QString fontname;
857 int size; 857 int size;
858 stream >> fontname; 858 stream >> fontname;
859 stream >> size; 859 stream >> size;
860 setfontHelper(fontname, size); 860 setfontHelper(fontname, size);
861 } 861 }
862 else if ( msg == "Marks/Autogen(QString)" ) 862 else if ( msg == "Marks/Autogen(QString)" )
863 { 863 {
864 QString info; 864 QString info;
865 stream >> info; 865 stream >> info;
866 do_autogen(info); 866 do_autogen(info);
867 } 867 }
868} 868}
869 869
@@ -871,7 +871,7 @@ ActionTypes QTReaderApp::ActNameToInt(const QString& _enc)
871{ 871{
872 for (int i = 0; i < MAX_ACTIONS; i++) 872 for (int i = 0; i < MAX_ACTIONS; i++)
873 { 873 {
874 if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i; 874 if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i;
875 } 875 }
876 return cesAutoScroll; 876 return cesAutoScroll;
877} 877}
@@ -880,7 +880,7 @@ int QTReaderApp::EncNameToInt(const QString& _enc)
880{ 880{
881 for (int i = 0; i < MAX_ENCODING; i++) 881 for (int i = 0; i < MAX_ENCODING; i++)
882 { 882 {
883 if (m_EncodingAction[i]->text() == _enc) return i; 883 if (m_EncodingAction[i]->text() == _enc) return i;
884 } 884 }
885 return 0; 885 return 0;
886/* 886/*
@@ -914,19 +914,19 @@ void QTReaderApp::autoScroll(bool _b)
914 914
915void QTReaderApp::TBD() 915void QTReaderApp::TBD()
916{ 916{
917 QMessageBox::information(this, "QTReader", "Not yet implemented", 1); 917 QMessageBox::information(this, "OpieReader", "Not yet implemented", 1);
918} 918}
919 919
920void QTReaderApp::TBDzoom() 920void QTReaderApp::TBDzoom()
921{ 921{
922 QMessageBox::information(this, "QTReader", "Zooming is done interactively\nTry left/right cursor keys", 1); 922 QMessageBox::information(this, "OpieReader", "Zooming is done interactively\nTry left/right cursor keys", 1);
923} 923}
924 924
925void QTReaderApp::clearBkmkList() 925void QTReaderApp::clearBkmkList()
926{ 926{
927 delete pBkmklist; 927 delete pBkmklist;
928 pBkmklist = NULL; 928 pBkmklist = NULL;
929 m_fBkmksChanged = false; 929 m_fBkmksChanged = false;
930} 930}
931 931
932void QTReaderApp::fileOpen() 932void QTReaderApp::fileOpen()
@@ -939,30 +939,30 @@ void QTReaderApp::fileOpen()
939*/ 939*/
940 if (pBkmklist != NULL) 940 if (pBkmklist != NULL)
941 { 941 {
942 if (m_fBkmksChanged) 942 if (m_fBkmksChanged)
943 { 943 {
944 if (QMessageBox::warning(this, "QTReader", "Save bookmarks?", "Save", "Don't bother") == 0) 944 if (QMessageBox::warning(this, "OpieReader", "Save bookmarks?", "Save", "Don't bother") == 0)
945 savebkmks(); 945 savebkmks();
946 } 946 }
947 delete pBkmklist; 947 delete pBkmklist;
948 pBkmklist = NULL; 948 pBkmklist = NULL;
949 m_fBkmksChanged = false; 949 m_fBkmksChanged = false;
950 } 950 }
951 reader->disableAutoscroll(); 951 reader->disableAutoscroll();
952/* 952/*
953 editorStack->raiseWidget( fileSelector ); 953 editorStack->raiseWidget( fileSelector );
954 fileSelector->reread(); 954 fileSelector->reread();
955*/ 955*/
956 fileBrowser* fb = new fileBrowser(this,"QTReader",TRUE, 956 fileBrowser* fb = new fileBrowser(this,"OpieReader",TRUE,
957 0, 957 0,
958 // WStyle_Customize | WStyle_NoBorderEx, 958// WStyle_Customize | WStyle_NoBorderEx,
959 "*", QFileInfo(reader->m_lastfile).dirPath(true)); 959 "*", QFileInfo(reader->m_lastfile).dirPath(true));
960 960
961 if (fb->exec()) 961 if (fb->exec())
962 { 962 {
963 QString fn(fb->fileList[0]); 963 QString fn(fb->fileList[0]);
964// fb->populateList(); 964// fb->populateList();
965 if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn); 965 if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn);
966 } 966 }
967 delete fb; 967 delete fb;
968 reader->setFocus(); 968 reader->setFocus();
@@ -973,19 +973,19 @@ void QTReaderApp::showinfo()
973 unsigned long fs, ts, pl; 973 unsigned long fs, ts, pl;
974 if (reader->empty()) 974 if (reader->empty())
975 { 975 {
976 QMessageBox::information(this, "QTReader", "No file loaded", 1); 976 QMessageBox::information(this, "OpieReader", "No file loaded", 1);
977 } 977 }
978 else 978 else
979 { 979 {
980 reader->sizes(fs,ts); 980 reader->sizes(fs,ts);
981 pl = reader->pagelocate(); 981 pl = reader->pagelocate();
982 m_infoWin->setFileSize(fs); 982 m_infoWin->setFileSize(fs);
983 m_infoWin->setTextSize(ts); 983 m_infoWin->setTextSize(ts);
984 m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); 984 m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts);
985 m_infoWin->setLocation(pl); 985 m_infoWin->setLocation(pl);
986 m_infoWin->setRead((100*pl + (ts >> 1))/ts); 986 m_infoWin->setRead((100*pl + (ts >> 1))/ts);
987 editorStack->raiseWidget( m_infoWin ); 987 editorStack->raiseWidget( m_infoWin );
988 m_infoWin->setFocus(); 988 m_infoWin->setFocus();
989 } 989 }
990} 990}
991 991
@@ -997,13 +997,13 @@ void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn)
997 int i; 997 int i;
998 for (i = 0; i < name.length(); i++) 998 for (i = 0; i < name.length(); i++)
999 { 999 {
1000 buff[i] = name[i].unicode(); 1000 buff[i] = name[i].unicode();
1001 } 1001 }
1002 buff[i] = 0; 1002 buff[i] = 0;
1003 CBuffer buff2(text.length()+1); 1003 CBuffer buff2(text.length()+1);
1004 for (i = 0; i < text.length(); i++) 1004 for (i = 0; i < text.length(); i++)
1005 { 1005 {
1006 buff2[i] = text[i].unicode(); 1006 buff2[i] = text[i].unicode();
1007 } 1007 }
1008 buff2[i] = 0; 1008 buff2[i] = 0;
1009 pBkmklist->push_front(Bkmk(buff.data(), buff2.data(), posn)); 1009 pBkmklist->push_front(Bkmk(buff.data(), buff2.data(), posn));
@@ -1018,40 +1018,40 @@ void QTReaderApp::addAnno(const QString& name, const QString& text)
1018{ 1018{
1019 if (m_annoIsEditing) 1019 if (m_annoIsEditing)
1020 { 1020 {
1021 if (name.isEmpty()) 1021 if (name.isEmpty())
1022 { 1022 {
1023 QMessageBox::information(this, "QTReader", "Need a name for the bookmark\nPlease try again", 1); 1023 QMessageBox::information(this, "OpieReader", "Need a name for the bookmark\nPlease try again", 1);
1024 } 1024 }
1025 else 1025 else
1026 { 1026 {
1027 addAnno(name, text, m_annoWin->getPosn()); 1027 addAnno(name, text, m_annoWin->getPosn());
1028 } 1028 }
1029 showEditTools(); 1029 showEditTools();
1030 } 1030 }
1031 else 1031 else
1032 { 1032 {
1033 if (m_annoWin->edited()) 1033 if (m_annoWin->edited())
1034 { 1034 {
1035 CBuffer buff(text.length()+1); 1035 CBuffer buff(text.length()+1);
1036 int i; 1036 int i;
1037 for (i = 0; i < text.length(); i++) 1037 for (i = 0; i < text.length(); i++)
1038 { 1038 {
1039 buff[i] = text[i].unicode(); 1039 buff[i] = text[i].unicode();
1040 } 1040 }
1041 buff[i] = 0; 1041 buff[i] = 0;
1042 m_fBkmksChanged = true; 1042 m_fBkmksChanged = true;
1043 m_anno->setAnno(buff.data()); 1043 m_anno->setAnno(buff.data());
1044 } 1044 }
1045 bool found = findNextBookmark(m_anno->value()+1); 1045 bool found = findNextBookmark(m_anno->value()+1);
1046 if (found) 1046 if (found)
1047 { 1047 {
1048 m_annoWin->setName(toQString(m_anno->name())); 1048 m_annoWin->setName(toQString(m_anno->name()));
1049 m_annoWin->setAnno(toQString(m_anno->anno())); 1049 m_annoWin->setAnno(toQString(m_anno->anno()));
1050 } 1050 }
1051 else 1051 else
1052 { 1052 {
1053 showEditTools(); 1053 showEditTools();
1054 } 1054 }
1055 } 1055 }
1056} 1056}
1057 1057
@@ -1060,15 +1060,15 @@ bool QTReaderApp::findNextBookmark(size_t start)
1060 bool found = false; 1060 bool found = false;
1061 for (CList<Bkmk>::iterator iter = pBkmklist->begin(); iter != pBkmklist->end(); iter++) 1061 for (CList<Bkmk>::iterator iter = pBkmklist->begin(); iter != pBkmklist->end(); iter++)
1062 { 1062 {
1063 if (iter->value() >= start) 1063 if (iter->value() >= start)
1064 { 1064 {
1065 if (iter->value() < reader->locate()) 1065 if (iter->value() < reader->locate())
1066 { 1066 {
1067 found = true; 1067 found = true;
1068 m_anno = iter.pContent(); 1068 m_anno = iter.pContent();
1069 } 1069 }
1070 break; 1070 break;
1071 } 1071 }
1072 } 1072 }
1073 return found; 1073 return found;
1074} 1074}
@@ -1077,16 +1077,16 @@ void QTReaderApp::addanno()
1077{ 1077{
1078 if (reader->empty()) 1078 if (reader->empty())
1079 { 1079 {
1080 QMessageBox::information(this, "QTReader", "No file loaded", 1); 1080 QMessageBox::information(this, "OpieReader", "No file loaded", 1);
1081 } 1081 }
1082 else 1082 else
1083 { 1083 {
1084 m_annoWin->setName(""); 1084 m_annoWin->setName("");
1085 m_annoWin->setAnno(""); 1085 m_annoWin->setAnno("");
1086 m_annoWin->setPosn(reader->pagelocate()); 1086 m_annoWin->setPosn(reader->pagelocate());
1087 m_annoIsEditing = true; 1087 m_annoIsEditing = true;
1088 editorStack->raiseWidget( m_annoWin ); 1088 editorStack->raiseWidget( m_annoWin );
1089 m_annoWin->setFocus(); 1089 m_annoWin->setFocus();
1090 } 1090 }
1091} 1091}
1092 1092
@@ -1116,18 +1116,18 @@ void QTReaderApp::editMark()
1116 1116
1117void QTReaderApp::editCopy() 1117void QTReaderApp::editCopy()
1118{ 1118{
1119 QClipboard* cb = QApplication::clipboard(); 1119 QClipboard* cb = QApplication::clipboard();
1120 QString text; 1120 QString text;
1121 int ch; 1121 int ch;
1122 unsigned long currentpos = reader->pagelocate(); 1122 unsigned long currentpos = reader->pagelocate();
1123 unsigned long endpos = reader->locate(); 1123 unsigned long endpos = reader->locate();
1124 reader->jumpto(m_savedpos); 1124 reader->jumpto(m_savedpos);
1125 while (reader->explocate() < endpos && (ch = reader->getch()) != UEOF) 1125 while (reader->explocate() < endpos && (ch = reader->getch()) != UEOF)
1126 { 1126 {
1127 text += ch; 1127 text += ch;
1128 } 1128 }
1129 cb->setText(text); 1129 cb->setText(text);
1130 reader->locate(currentpos); 1130 reader->locate(currentpos);
1131} 1131}
1132 1132
1133void QTReaderApp::pageup() 1133void QTReaderApp::pageup()
@@ -1216,8 +1216,8 @@ void QTReaderApp::settarget()
1216{ 1216{
1217 m_nRegAction = cSetTarget; 1217 m_nRegAction = cSetTarget;
1218 QString text = ((m_targetapp.isEmpty()) ? QString("") : m_targetapp) 1218 QString text = ((m_targetapp.isEmpty()) ? QString("") : m_targetapp)
1219 + "/" 1219 + "/"
1220 + ((m_targetmsg.isEmpty()) ? QString("") : m_targetmsg); 1220 + ((m_targetmsg.isEmpty()) ? QString("") : m_targetmsg);
1221 regEdit->setText(text); 1221 regEdit->setText(text);
1222 do_regedit(); 1222 do_regedit();
1223} 1223}
@@ -1228,10 +1228,10 @@ void QTReaderApp::do_overlap(const QString& lcn)
1228 unsigned long ulcn = lcn.toULong(&ok); 1228 unsigned long ulcn = lcn.toULong(&ok);
1229 if (ok) 1229 if (ok)
1230 { 1230 {
1231 reader->m_overlap = ulcn; 1231 reader->m_overlap = ulcn;
1232 } 1232 }
1233 else 1233 else
1234 QMessageBox::information(this, "QTReader", "Must be a number"); 1234 QMessageBox::information(this, "OpieReader", "Must be a number");
1235} 1235}
1236 1236
1237void QTReaderApp::do_mono(const QString& lcn) 1237void QTReaderApp::do_mono(const QString& lcn)
@@ -1240,13 +1240,13 @@ void QTReaderApp::do_mono(const QString& lcn)
1240 unsigned long ulcn = lcn.toULong(&ok); 1240 unsigned long ulcn = lcn.toULong(&ok);
1241 if (ok) 1241 if (ok)
1242 { 1242 {
1243 reader->m_charpc = ulcn; 1243 reader->m_charpc = ulcn;
1244 reader->setfont(); 1244 reader->setfont();
1245 reader->refresh(); 1245 reader->refresh();
1246 //reader->setmono(true); 1246// reader->setmono(true);
1247 } 1247 }
1248 else 1248 else
1249 QMessageBox::information(this, "QTReader", "Must be a number"); 1249 QMessageBox::information(this, "OpieReader", "Must be a number");
1250} 1250}
1251 1251
1252/* 1252/*
@@ -1332,15 +1332,15 @@ bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg)
1332 { 1332 {
1333 pos = reader->locate(); 1333 pos = reader->locate();
1334 if (!reader->buffdoc.getline(&test,reader->width())) 1334 if (!reader->buffdoc.getline(&test,reader->width()))
1335 { 1335 {
1336 if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) 1336 if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2)
1337 pos = searchStart; 1337 pos = searchStart;
1338 else 1338 else
1339 pos = start; 1339 pos = start;
1340 ret = false; 1340 ret = false;
1341 findClose(); 1341 findClose();
1342 break; 1342 break;
1343 } 1343 }
1344 } 1344 }
1345 reader->locate(pos); 1345 reader->locate(pos);
1346 return ret; 1346 return ret;
@@ -1418,22 +1418,22 @@ void QTReaderApp::openFile( const DocLnk &f )
1418 } 1418 }
1419 else 1419 else
1420 { 1420 {
1421 QMessageBox::information(this, "QTReader", "File does not exist"); 1421 QMessageBox::information(this, "OpieReader", "File does not exist");
1422 } 1422 }
1423 1423
1424} 1424}
1425 1425
1426void QTReaderApp::showEditTools() 1426void QTReaderApp::showEditTools()
1427{ 1427{
1428 if ( !doc ) 1428 if ( !doc )
1429 close(); 1429 close();
1430// fileSelector->hide(); 1430// fileSelector->hide();
1431//tjw menu->show(); 1431//tjw menu->show();
1432 editBar->show(); 1432 editBar->show();
1433 if ( searchVisible ) 1433 if ( searchVisible )
1434 searchBar->show(); 1434 searchBar->show();
1435 if ( regVisible ) 1435 if ( regVisible )
1436 regBar->show(); 1436 regBar->show();
1437 if (m_fontVisible) m_fontBar->show(); 1437 if (m_fontVisible) m_fontBar->show();
1438 1438
1439 updateCaption(); 1439 updateCaption();
@@ -1444,27 +1444,27 @@ void QTReaderApp::showEditTools()
1444void QTReaderApp::save() 1444void QTReaderApp::save()
1445{ 1445{
1446 if ( !doc ) 1446 if ( !doc )
1447 return; 1447 return;
1448 if ( !editor->edited() ) 1448 if ( !editor->edited() )
1449 return; 1449 return;
1450 1450
1451 QString rt = editor->text(); 1451 QString rt = editor->text();
1452 QString pt = rt; 1452 QString pt = rt;
1453 1453
1454 if ( doc->name().isEmpty() ) { 1454 if ( doc->name().isEmpty() ) {
1455 unsigned ispace = pt.find( ' ' ); 1455 unsigned ispace = pt.find( ' ' );
1456 unsigned ienter = pt.find( '\n' ); 1456 unsigned ienter = pt.find( '\n' );
1457 int i = (ispace < ienter) ? ispace : ienter; 1457 int i = (ispace < ienter) ? ispace : ienter;
1458 QString docname; 1458 QString docname;
1459 if ( i == -1 ) { 1459 if ( i == -1 ) {
1460 if ( pt.isEmpty() ) 1460 if ( pt.isEmpty() )
1461 docname = "Empty Text"; 1461 docname = "Empty Text";
1462 else 1462 else
1463 docname = pt; 1463 docname = pt;
1464 } else { 1464 } else {
1465 docname = pt.left( i ); 1465 docname = pt.left( i );
1466 } 1466 }
1467 doc->setName(docname); 1467 doc->setName(docname);
1468 } 1468 }
1469 FileManager fm; 1469 FileManager fm;
1470 fm.saveFile( *doc, rt ); 1470 fm.saveFile( *doc, rt );
@@ -1476,9 +1476,9 @@ void QTReaderApp::clear()
1476 if (doc != 0) 1476 if (doc != 0)
1477 { 1477 {
1478// QMessageBox::information(this, "QTReader", "Deleting doc", 1); 1478// QMessageBox::information(this, "QTReader", "Deleting doc", 1);
1479 delete doc; 1479 delete doc;
1480// QMessageBox::information(this, "QTReader", "Deleted doc", 1); 1480// QMessageBox::information(this, "QTReader", "Deleted doc", 1);
1481 doc = 0; 1481 doc = 0;
1482 } 1482 }
1483 reader->clear(); 1483 reader->clear();
1484} 1484}
@@ -1486,12 +1486,12 @@ void QTReaderApp::clear()
1486void QTReaderApp::updateCaption() 1486void QTReaderApp::updateCaption()
1487{ 1487{
1488 if ( !doc ) 1488 if ( !doc )
1489 setCaption( tr("QTReader") ); 1489 setCaption( tr("OpieReader") );
1490 else { 1490 else {
1491 QString s = doc->name(); 1491 QString s = doc->name();
1492 if ( s.isEmpty() ) 1492 if ( s.isEmpty() )
1493 s = tr( "Unnamed" ); 1493 s = tr( "Unnamed" );
1494 setCaption( s + " - " + tr("QTReader") ); 1494 setCaption( s + " - " + tr("OpieReader") );
1495 } 1495 }
1496} 1496}
1497 1497
@@ -1507,45 +1507,45 @@ void QTReaderApp::closeEvent( QCloseEvent *e )
1507{ 1507{
1508 if (m_dontSave) 1508 if (m_dontSave)
1509 { 1509 {
1510 e->accept(); 1510 e->accept();
1511 } 1511 }
1512 else 1512 else
1513 { 1513 {
1514 if (editorStack->visibleWidget() == reader) 1514 if (editorStack->visibleWidget() == reader)
1515 { 1515 {
1516 if (m_fontVisible) 1516 if (m_fontVisible)
1517 { 1517 {
1518 m_fontBar->hide(); 1518 m_fontBar->hide();
1519 m_fontVisible = false; 1519 m_fontVisible = false;
1520 } 1520 }
1521 if (regVisible) 1521 if (regVisible)
1522 { 1522 {
1523 regBar->hide(); 1523 regBar->hide();
1524 regVisible = false; 1524 regVisible = false;
1525 return; 1525 return;
1526 } 1526 }
1527 if (searchVisible) 1527 if (searchVisible)
1528 { 1528 {
1529 searchBar->hide(); 1529 searchBar->hide();
1530 searchVisible = false; 1530 searchVisible = false;
1531 return; 1531 return;
1532 } 1532 }
1533 if (m_fBkmksChanged && pBkmklist != NULL) 1533 if (m_fBkmksChanged && pBkmklist != NULL)
1534 { 1534 {
1535 if (QMessageBox::warning(this, "QTReader", "Save bookmarks?", "Save", "Don't bother") == 0) 1535 if (QMessageBox::warning(this, "OpieReader", "Save bookmarks?", "Save", "Don't bother") == 0)
1536 savebkmks(); 1536 savebkmks();
1537 delete pBkmklist; 1537 delete pBkmklist;
1538 pBkmklist = NULL; 1538 pBkmklist = NULL;
1539 m_fBkmksChanged = false; 1539 m_fBkmksChanged = false;
1540 } 1540 }
1541 bFromDocView = FALSE; 1541 bFromDocView = FALSE;
1542 saveprefs(); 1542 saveprefs();
1543 e->accept(); 1543 e->accept();
1544 } 1544 }
1545 else 1545 else
1546 { 1546 {
1547 showEditTools(); 1547 showEditTools();
1548 } 1548 }
1549 } 1549 }
1550} 1550}
1551 1551
@@ -1567,15 +1567,15 @@ void QTReaderApp::listbkmk()
1567 int cnt = 0; 1567 int cnt = 0;
1568 if (pBkmklist != NULL) 1568 if (pBkmklist != NULL)
1569 { 1569 {
1570 for (CList<Bkmk>::iterator i = pBkmklist->begin(); i != pBkmklist->end(); i++) 1570 for (CList<Bkmk>::iterator i = pBkmklist->begin(); i != pBkmklist->end(); i++)
1571 { 1571 {
1572#ifdef _UNICODE 1572#ifdef _UNICODE
1573 bkmkselector->insertItem(toQString(i->name())); 1573 bkmkselector->insertItem(toQString(i->name()));
1574#else 1574#else
1575 bkmkselector->insertItem(i->name()); 1575 bkmkselector->insertItem(i->name());
1576#endif 1576#endif
1577 cnt++; 1577 cnt++;
1578 } 1578 }
1579 } 1579 }
1580 if (cnt > 0) 1580 if (cnt > 0)
1581 { 1581 {
@@ -1587,7 +1587,7 @@ void QTReaderApp::listbkmk()
1587 editorStack->raiseWidget( bkmkselector ); 1587 editorStack->raiseWidget( bkmkselector );
1588 } 1588 }
1589 else 1589 else
1590 QMessageBox::information(this, "QTReader", "No bookmarks in memory"); 1590 QMessageBox::information(this, "OpieReader", "No bookmarks in memory");
1591} 1591}
1592 1592
1593void QTReaderApp::do_autogen() 1593void QTReaderApp::do_autogen()
@@ -1609,18 +1609,18 @@ void QTReaderApp::gotobkmk(int ind)
1609{ 1609{
1610 switch (m_nRegAction) 1610 switch (m_nRegAction)
1611 { 1611 {
1612 case cGotoBkmk: 1612 case cGotoBkmk:
1613 reader->locate((*pBkmklist)[ind]->value()); 1613 reader->locate((*pBkmklist)[ind]->value());
1614 break; 1614 break;
1615 case cDelBkmk: 1615 case cDelBkmk:
1616 // qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name()); 1616// qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name());
1617 pBkmklist->erase(ind); 1617 pBkmklist->erase(ind);
1618 m_fBkmksChanged = true; 1618 m_fBkmksChanged = true;
1619 // pBkmklist->sort(); 1619// pBkmklist->sort();
1620 break; 1620 break;
1621 case cRmBkmkFile: 1621 case cRmBkmkFile:
1622 unlink((const char *)Global::applicationFileName("uqtreader",bkmkselector->text(ind))); 1622 unlink((const char *)Global::applicationFileName("uqtreader",bkmkselector->text(ind)));
1623 break; 1623 break;
1624 } 1624 }
1625 showEditTools(); 1625 showEditTools();
1626} 1626}
@@ -1644,9 +1644,9 @@ void QTReaderApp::do_jump(const QString& lcn)
1644 bool ok; 1644 bool ok;
1645 unsigned long ulcn = lcn.toULong(&ok); 1645 unsigned long ulcn = lcn.toULong(&ok);
1646 if (ok) 1646 if (ok)
1647 reader->locate(ulcn); 1647 reader->locate(ulcn);
1648 else 1648 else
1649 QMessageBox::information(this, "QTReader", "Must be a number"); 1649 QMessageBox::information(this, "OpieReader", "Must be a number");
1650} 1650}
1651 1651
1652void QTReaderApp::do_regaction() 1652void QTReaderApp::do_regaction()
@@ -1656,23 +1656,23 @@ void QTReaderApp::do_regaction()
1656 switch(m_nRegAction) 1656 switch(m_nRegAction)
1657 { 1657 {
1658 case cAutoGen: 1658 case cAutoGen:
1659 do_autogen(regEdit->text()); 1659 do_autogen(regEdit->text());
1660 break; 1660 break;
1661 case cAddBkmk: 1661 case cAddBkmk:
1662 do_addbkmk(regEdit->text()); 1662 do_addbkmk(regEdit->text());
1663 break; 1663 break;
1664 case cJump: 1664 case cJump:
1665 do_jump(regEdit->text()); 1665 do_jump(regEdit->text());
1666 break; 1666 break;
1667 case cMonoSpace: 1667 case cMonoSpace:
1668 do_mono(regEdit->text()); 1668 do_mono(regEdit->text());
1669 break; 1669 break;
1670 case cOverlap: 1670 case cOverlap:
1671 do_overlap(regEdit->text()); 1671 do_overlap(regEdit->text());
1672 break; 1672 break;
1673 case cSetTarget: 1673 case cSetTarget:
1674 do_settarget(regEdit->text()); 1674 do_settarget(regEdit->text());
1675 break; 1675 break;
1676 } 1676 }
1677 reader->restore(); 1677 reader->restore();
1678// editBar->show(); 1678// editBar->show();
@@ -1684,14 +1684,14 @@ void QTReaderApp::do_settarget(const QString& _txt)
1684 int ind = _txt.find('/'); 1684 int ind = _txt.find('/');
1685 if (ind == -1) 1685 if (ind == -1)
1686 { 1686 {
1687 m_targetapp = ""; 1687 m_targetapp = "";
1688 m_targetmsg = ""; 1688 m_targetmsg = "";
1689 QMessageBox::information(this, "QTReader", "Format is\nappname/messagename"); 1689 QMessageBox::information(this, "OpieReader", "Format is\nappname/messagename");
1690 } 1690 }
1691 else 1691 else
1692 { 1692 {
1693 m_targetapp = _txt.left(ind); 1693 m_targetapp = _txt.left(ind);
1694 m_targetmsg = _txt.right(_txt.length()-ind-1); 1694 m_targetmsg = _txt.right(_txt.length()-ind-1);
1695 } 1695 }
1696} 1696}
1697 1697
@@ -1699,11 +1699,11 @@ void QTReaderApp::setfont()
1699{ 1699{
1700 for (int i = 1; i <= m_fontSelector->count(); i++) 1700 for (int i = 1; i <= m_fontSelector->count(); i++)
1701 { 1701 {
1702 if (m_fontSelector->text(i) == reader->m_fontname) 1702 if (m_fontSelector->text(i) == reader->m_fontname)
1703 { 1703 {
1704 m_fontSelector->setCurrentItem(i); 1704 m_fontSelector->setCurrentItem(i);
1705 break; 1705 break;
1706 } 1706 }
1707 } 1707 }
1708 m_fontBar->show(); 1708 m_fontBar->show();
1709 m_fontVisible = true; 1709 m_fontVisible = true;
@@ -1720,7 +1720,7 @@ void QTReaderApp::setfontHelper(const QString& lcn, int size = 0)
1720 reader->m_fontname = lcn; 1720 reader->m_fontname = lcn;
1721 if (!reader->ChangeFont(size)) 1721 if (!reader->ChangeFont(size))
1722 { 1722 {
1723 reader->ChangeFont(size); 1723 reader->ChangeFont(size);
1724 } 1724 }
1725 reader->refresh(); 1725 reader->refresh();
1726 m_fontBar->hide(); 1726 m_fontBar->hide();
@@ -1759,9 +1759,9 @@ pbar->resize(width(), editBar->height());
1759 if (pc != lastpc) 1759 if (pc != lastpc)
1760 { 1760 {
1761 pbar->setProgress(pc); 1761 pbar->setProgress(pc);
1762 qApp->processEvents(); 1762 qApp->processEvents();
1763 if (reader->locate() != lcn) reader->jumpto(lcn); 1763 if (reader->locate() != lcn) reader->jumpto(lcn);
1764 reader->setFocus(); 1764 reader->setFocus();
1765 lastpc = pc; 1765 lastpc = pc;
1766 } 1766 }
1767 i = reader->buffdoc.getpara(buff); 1767 i = reader->buffdoc.getpara(buff);
@@ -1770,7 +1770,7 @@ pbar->resize(width(), editBar->height());
1770#else 1770#else
1771 if (re.match(buff.data()) != -1) 1771 if (re.match(buff.data()) != -1)
1772#endif 1772#endif
1773 pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); 1773 pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn));
1774 } 1774 }
1775 pBkmklist->sort(); 1775 pBkmklist->sort();
1776 pbar->setProgress(100); 1776 pbar->setProgress(100);
@@ -1844,40 +1844,40 @@ void info_cb(Fl_Widget* o, void* _data)
1844 1844
1845 if (infowin == NULL) 1845 if (infowin == NULL)
1846 { 1846 {
1847 1847
1848 infowin = new Fl_Window(160,240); 1848 infowin = new Fl_Window(160,240);
1849 filename = new Fl_Output(45,5,110,14,"Filename"); 1849 filename = new Fl_Output(45,5,110,14,"Filename");
1850 filesize = new Fl_Output(45,25,110,14,"Filesize"); 1850 filesize = new Fl_Output(45,25,110,14,"Filesize");
1851 textsize = new Fl_Output(45,45,110,14,"Textsize"); 1851 textsize = new Fl_Output(45,45,110,14,"Textsize");
1852 comprat = new CBar(45,65,110,14,"Ratio %"); 1852 comprat = new CBar(45,65,110,14,"Ratio %");
1853 posn = new Fl_Output(45,85,110,14,"Location"); 1853 posn = new Fl_Output(45,85,110,14,"Location");
1854 frcn = new CBar(45,105,110,14,"% Read"); 1854 frcn = new CBar(45,105,110,14,"% Read");
1855 about = new Fl_Multiline_Output(5,125,150,90); 1855 about = new Fl_Multiline_Output(5,125,150,90);
1856 about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files"); 1856 about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files");
1857 Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay"); 1857 Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay");
1858 infowin->set_modal(); 1858 infowin->set_modal();
1859 } 1859 }
1860 if (((reader_ui *)_data)->g_filename[0] != '\0') 1860 if (((reader_ui *)_data)->g_filename[0] != '\0')
1861 { 1861 {
1862 unsigned long fs,ts; 1862 unsigned long fs,ts;
1863 tchar sz[20]; 1863 tchar sz[20];
1864 ((reader_ui *)_data)->input->sizes(fs,ts); 1864 ((reader_ui *)_data)->input->sizes(fs,ts);
1865 unsigned long pl = ((reader_ui *)_data)->input->locate(); 1865 unsigned long pl = ((reader_ui *)_data)->input->locate();
1866 1866
1867 filename->value(((reader_ui *)_data)->g_filename); 1867 filename->value(((reader_ui *)_data)->g_filename);
1868 1868
1869 sprintf(sz,"%u",fs); 1869 sprintf(sz,"%u",fs);
1870 filesize->value(sz); 1870 filesize->value(sz);
1871 1871
1872 sprintf(sz,"%u",ts); 1872 sprintf(sz,"%u",ts);
1873 textsize->value(sz); 1873 textsize->value(sz);
1874 1874
1875 comprat->value(100-(100*fs + (ts >> 1))/ts); 1875 comprat->value(100-(100*fs + (ts >> 1))/ts);
1876 1876
1877 sprintf(sz,"%u",pl); 1877 sprintf(sz,"%u",pl);
1878 posn->value(sz); 1878 posn->value(sz);
1879 1879
1880 frcn->value((100*pl + (ts >> 1))/ts); 1880 frcn->value((100*pl + (ts >> 1))/ts);
1881 } 1881 }
1882 infowin->show(); 1882 infowin->show();
1883} 1883}
@@ -1887,27 +1887,27 @@ void QTReaderApp::savebkmks()
1887{ 1887{
1888 if (pBkmklist != NULL) 1888 if (pBkmklist != NULL)
1889 { 1889 {
1890 BkmkFile bf((const char *)Global::applicationFileName("uqtreader",reader->m_string), true); 1890 BkmkFile bf((const char *)Global::applicationFileName("uqtreader",reader->m_string), true);
1891 bf.write(*pBkmklist); 1891 bf.write(*pBkmklist);
1892 } 1892 }
1893 m_fBkmksChanged = false; 1893 m_fBkmksChanged = false;
1894} 1894}
1895 1895
1896void QTReaderApp::readbkmks() 1896void QTReaderApp::readbkmks()
1897{ 1897{
1898 if (pBkmklist != NULL) 1898 if (pBkmklist != NULL)
1899 { 1899 {
1900 delete pBkmklist; 1900 delete pBkmklist;
1901 } 1901 }
1902 BkmkFile bf((const char *)Global::applicationFileName("uqtreader",reader->m_string)); 1902 BkmkFile bf((const char *)Global::applicationFileName("uqtreader",reader->m_string));
1903 pBkmklist = bf.readall(); 1903 pBkmklist = bf.readall();
1904 m_fBkmksChanged = bf.upgraded(); 1904 m_fBkmksChanged = bf.upgraded();
1905 if (pBkmklist == NULL) 1905 if (pBkmklist == NULL)
1906 { 1906 {
1907 pBkmklist = reader->getbkmklist(); 1907 pBkmklist = reader->getbkmklist();
1908 } 1908 }
1909 if (pBkmklist != NULL) 1909 if (pBkmklist != NULL)
1910 pBkmklist->sort(); 1910 pBkmklist->sort();
1911} 1911}
1912 1912
1913void QTReaderApp::addbkmk() 1913void QTReaderApp::addbkmk()
@@ -1919,36 +1919,36 @@ void QTReaderApp::addbkmk()
1919 1919
1920void QTReaderApp::do_addbkmk(const QString& text) 1920void QTReaderApp::do_addbkmk(const QString& text)
1921{ 1921{
1922 if (text.isEmpty()) 1922 if (text.isEmpty())
1923 { 1923 {
1924 QMessageBox::information(this, "QTReader", "Need a name for the bookmark\nSelect add again", 1); 1924 QMessageBox::information(this, "OpieReader", "Need a name for the bookmark\nSelect add again", 1);
1925 } 1925 }
1926 else 1926 else
1927 { 1927 {
1928 if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>; 1928 if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>;
1929#ifdef _UNICODE 1929#ifdef _UNICODE
1930 CBuffer buff; 1930 CBuffer buff;
1931 int i = 0; 1931 int i = 0;
1932 for (i = 0; i < text.length(); i++) 1932 for (i = 0; i < text.length(); i++)
1933 { 1933 {
1934 buff[i] = text[i].unicode(); 1934 buff[i] = text[i].unicode();
1935 } 1935 }
1936 buff[i] = 0; 1936 buff[i] = 0;
1937 pBkmklist->push_front(Bkmk(buff.data(), NULL, reader->pagelocate())); 1937 pBkmklist->push_front(Bkmk(buff.data(), NULL, reader->pagelocate()));
1938#else 1938#else
1939 pBkmklist->push_front(Bkmk((const tchar*)text,reader->pagelocate())); 1939 pBkmklist->push_front(Bkmk((const tchar*)text,reader->pagelocate()));
1940#endif 1940#endif
1941 m_fBkmksChanged = true; 1941 m_fBkmksChanged = true;
1942 pBkmklist->sort(); 1942 pBkmklist->sort();
1943 } 1943 }
1944} 1944}
1945 1945
1946void QTReaderApp::OnRedraw() 1946void QTReaderApp::OnRedraw()
1947{ 1947{
1948 if (pBkmklist != NULL) 1948 if (pBkmklist != NULL)
1949 { 1949 {
1950 bool found = findNextBookmark(reader->pagelocate()); 1950 bool found = findNextBookmark(reader->pagelocate());
1951 m_bkmkAvail->setEnabled(found); 1951 m_bkmkAvail->setEnabled(found);
1952 } 1952 }
1953} 1953}
1954 1954
@@ -1967,33 +1967,33 @@ void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, const QString&
1967 1967
1968 if (m_doClipboard) 1968 if (m_doClipboard)
1969 { 1969 {
1970 QClipboard* cb = QApplication::clipboard(); 1970 QClipboard* cb = QApplication::clipboard();
1971 cb->setText(wrd); 1971 cb->setText(wrd);
1972 if (wrd.length() > 10) 1972 if (wrd.length() > 10)
1973 { 1973 {
1974 Global::statusMessage(wrd.left(8) + ".."); 1974 Global::statusMessage(wrd.left(8) + "..");
1975 } 1975 }
1976 else 1976 else
1977 { 1977 {
1978 Global::statusMessage(wrd); 1978 Global::statusMessage(wrd);
1979 } 1979 }
1980 } 1980 }
1981 if (m_doAnnotation) 1981 if (m_doAnnotation)
1982 { 1982 {
1983 //addAnno(wrd, "Need to be able to edit this", posn); 1983// addAnno(wrd, "Need to be able to edit this", posn);
1984 m_annoWin->setName(line); 1984 m_annoWin->setName(line);
1985 m_annoWin->setAnno(""); 1985 m_annoWin->setAnno("");
1986 m_annoWin->setPosn(posn); 1986 m_annoWin->setPosn(posn);
1987 m_annoIsEditing = true; 1987 m_annoIsEditing = true;
1988 editorStack->raiseWidget( m_annoWin ); 1988 editorStack->raiseWidget( m_annoWin );
1989 } 1989 }
1990 if (m_doDictionary) 1990 if (m_doDictionary)
1991 { 1991 {
1992 if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty()) 1992 if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty())
1993 { 1993 {
1994 QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8()); 1994 QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8());
1995 e << wrd; 1995 e << wrd;
1996 } 1996 }
1997 } 1997 }
1998} 1998}
1999 1999
@@ -2001,27 +2001,27 @@ void QTReaderApp::OnActionPressed()
2001{ 2001{
2002 switch (m_spaceTarget) 2002 switch (m_spaceTarget)
2003 { 2003 {
2004 case cesOpenFile: 2004 case cesOpenFile:
2005 { 2005 {
2006 fileOpen(); 2006 fileOpen();
2007 } 2007 }
2008 break; 2008 break;
2009 case cesAutoScroll: 2009 case cesAutoScroll:
2010 { 2010 {
2011 reader->setautoscroll(!reader->m_autoScroll); 2011 reader->setautoscroll(!reader->m_autoScroll);
2012 setScrollState(reader->m_autoScroll); 2012 setScrollState(reader->m_autoScroll);
2013 } 2013 }
2014 break; 2014 break;
2015 case cesActionMark: 2015 case cesActionMark:
2016 { 2016 {
2017 addbkmk(); 2017 addbkmk();
2018 } 2018 }
2019 break; 2019 break;
2020 default: 2020 default:
2021 { 2021 {
2022 qDebug("Unknown ActionType:%u", m_spaceTarget); 2022 qDebug("Unknown ActionType:%u", m_spaceTarget);
2023 } 2023 }
2024 break; 2024 break;
2025 } 2025 }
2026} 2026}
2027 2027