author | llornkcor <llornkcor> | 2002-09-14 02:19:09 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-09-14 02:19:09 (UTC) |
commit | 2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975 (patch) (unidiff) | |
tree | eeed16b5f80dd5883991a7a06133f5f7a6936256 /noncore/apps/opie-reader/QTReaderApp.cpp | |
parent | 5a95ed6a000a56849b8f093deea500214856c626 (diff) | |
download | opie-2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975.zip opie-2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975.tar.gz opie-2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975.tar.bz2 |
update by Tim
Diffstat (limited to 'noncore/apps/opie-reader/QTReaderApp.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/QTReaderApp.cpp | 780 |
1 files changed, 688 insertions, 92 deletions
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp index 68c80c1..0608b66 100644 --- a/noncore/apps/opie-reader/QTReaderApp.cpp +++ b/noncore/apps/opie-reader/QTReaderApp.cpp | |||
@@ -20,2 +20,3 @@ | |||
20 | 20 | ||
21 | #include <qclipboard.h> | ||
21 | #include <qwidgetstack.h> | 22 | #include <qwidgetstack.h> |
@@ -40,6 +41,10 @@ | |||
40 | #include <qradiobutton.h> | 41 | #include <qradiobutton.h> |
42 | #include <qpe/qcopenvelope_qws.h> | ||
41 | 43 | ||
44 | #include "QTReader.h" | ||
45 | #include "Bkmks.h" | ||
42 | #include "cbkmkselector.h" | 46 | #include "cbkmkselector.h" |
43 | #include "infowin.h" | 47 | #include "infowin.h" |
44 | 48 | #include "CAnnoEdit.h" | |
49 | #include "QFloatBar.h" | ||
45 | //#include <qpe/fontdatabase.h> | 50 | //#include <qpe/fontdatabase.h> |
@@ -51,2 +56,3 @@ | |||
51 | #include "fileBrowser.h" | 56 | #include "fileBrowser.h" |
57 | #include "CDrawBuffer.h" | ||
52 | 58 | ||
@@ -86,3 +92,3 @@ void QTReaderApp::listBkmkFiles() | |||
86 | { | 92 | { |
87 | menu->hide(); | 93 | //tjw menu->hide(); |
88 | editBar->hide(); | 94 | editBar->hide(); |
@@ -99,3 +105,3 @@ void QTReaderApp::listBkmkFiles() | |||
99 | QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | 105 | QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) |
100 | : QMainWindow( parent, name, f ), bFromDocView( FALSE ) | 106 | : QMainWindow( parent, name, f ), bFromDocView( FALSE ), m_dontSave(false) |
101 | { | 107 | { |
@@ -119,3 +125,3 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
119 | addToolBar(bar, "tool",QMainWindow::Top, true); | 125 | addToolBar(bar, "tool",QMainWindow::Top, true); |
120 | menu = bar; | 126 | //tjw menu = bar; |
121 | 127 | ||
@@ -146,2 +152,7 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
146 | 152 | ||
153 | m_annoWin = new CAnnoEdit(editorStack); | ||
154 | editorStack->addWidget(m_annoWin, get_unique_id()); | ||
155 | connect( m_annoWin, SIGNAL( finished(const QString&, const QString&) ), this, SLOT( addAnno(const QString&, const QString&) ) ); | ||
156 | connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) ); | ||
157 | |||
147 | m_infoWin = new infowin(editorStack); | 158 | m_infoWin = new infowin(editorStack); |
@@ -168,2 +179,5 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
168 | reader = new QTReader( editorStack ); | 179 | reader = new QTReader( editorStack ); |
180 | |||
181 | ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); | ||
182 | |||
169 | Config config( "uqtreader" ); | 183 | Config config( "uqtreader" ); |
@@ -172,3 +186,6 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
172 | reader->bstripcr = config.readBoolEntry( "StripCr", true ); | 186 | reader->bstripcr = config.readBoolEntry( "StripCr", true ); |
187 | reader->btextfmt = config.readBoolEntry( "TextFmt", false ); | ||
188 | reader->bautofmt = config.readBoolEntry( "AutoFmt", true ); | ||
173 | reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); | 189 | reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); |
190 | reader->bpeanut = config.readBoolEntry( "Peanut", false ); | ||
174 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); | 191 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); |
@@ -179,3 +196,2 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
179 | reader->m_textsize = config.readNumEntry( "FontSize", 12 ); | 196 | reader->m_textsize = config.readNumEntry( "FontSize", 12 ); |
180 | reader->m_bBold = config.readBoolEntry( "Bold", false ); | ||
181 | reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); | 197 | reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); |
@@ -189,5 +205,17 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
189 | reader->m_overlap = config.readNumEntry( "Overlap", 0 ); | 205 | reader->m_overlap = config.readNumEntry( "Overlap", 0 ); |
190 | reader->m_targetapp = config.readEntry( "TargetApp", QString::null ); | 206 | reader->bremap = config.readBoolEntry( "Remap", true ); |
191 | reader->m_targetmsg = config.readEntry( "TargetMsg", QString::null ); | 207 | reader->bmakebold = config.readBoolEntry( "MakeBold", false ); |
192 | reader->init(); | 208 | m_targetapp = config.readEntry( "TargetApp", QString::null ); |
209 | m_targetmsg = config.readEntry( "TargetMsg", QString::null ); | ||
210 | m_twoTouch = config.readBoolEntry( "TwoTouch", false); | ||
211 | m_doAnnotation = config.readBoolEntry( "Annotation", false); | ||
212 | m_doDictionary = config.readBoolEntry( "Dictionary", false); | ||
213 | m_doClipboard = config.readBoolEntry( "Clipboard", false); | ||
214 | m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll); | ||
215 | setTwoTouch(m_twoTouch); | ||
216 | |||
217 | |||
218 | connect( reader, SIGNAL( OnRedraw() ), this, SLOT( OnRedraw() ) ); | ||
219 | connect( reader, SIGNAL( OnActionPressed() ), this, SLOT( OnActionPressed() ) ); | ||
220 | connect( reader, SIGNAL( OnWordSelected(const QString&, size_t, const QString&) ), this, SLOT( OnWordSelected(const QString&, size_t, const QString&) ) ); | ||
193 | editorStack->addWidget( reader, get_unique_id() ); | 221 | editorStack->addWidget( reader, get_unique_id() ); |
@@ -214,12 +242,18 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
214 | 242 | ||
215 | a = new QAction( tr( "Start Block" ), QString::null, 0, this, NULL); | 243 | QActionGroup* ag = new QActionGroup(this); |
216 | connect( a, SIGNAL( activated() ), this, SLOT( editMark() ) ); | 244 | QPopupMenu *spacemenu = new QPopupMenu(this); |
217 | file->insertSeparator(); | 245 | file->insertItem( tr( "On Action..." ), spacemenu ); |
218 | a->addTo( file ); | ||
219 | 246 | ||
220 | a = new QAction( tr( "Copy Block" ), QString::null, 0, this, NULL); | 247 | m_buttonAction[0] = new QAction( tr( "Open File" ), QString::null, 0, ag, NULL, true ); |
221 | connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); | 248 | |
222 | a->addTo( file ); | 249 | m_buttonAction[1] = new QAction( tr( "Autoscroll" ), QString::null, 0, ag, NULL, true ); |
250 | |||
251 | m_buttonAction[2] = new QAction( tr( "Mark" ), QString::null, 0, ag, NULL, true ); | ||
252 | |||
253 | ag->addTo(spacemenu); | ||
254 | |||
255 | connect(ag, SIGNAL( selected(QAction*) ), this, SLOT( buttonActionSelected(QAction*) ) ); | ||
223 | 256 | ||
224 | a = m_scrollButton = new QAction( tr( "Scroll" ), Resource::loadPixmap( "opie-reader/panel-arrow-down" ), QString::null, 0, this, 0, true ); | 257 | |
258 | a = m_scrollButton = new QAction( tr( "Scroll" ), Resource::loadPixmap( "panel-arrow-down" ), QString::null, 0, this, 0, true ); | ||
225 | // connect( a, SIGNAL( activated() ), this, SLOT( autoScroll() ) ); | 259 | // connect( a, SIGNAL( activated() ), this, SLOT( autoScroll() ) ); |
@@ -244,3 +278,3 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
244 | 278 | ||
245 | a = new QAction( tr( "Page/Line scroll" ), QString::null, 0, this, NULL, true ); | 279 | a = new QAction( tr( "Page/Line Scroll" ), QString::null, 0, this, NULL, true ); |
246 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( pagemode(bool) ) ); | 280 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( pagemode(bool) ) ); |
@@ -253,2 +287,4 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
253 | 287 | ||
288 | file->insertSeparator(); | ||
289 | |||
254 | a = new QAction( tr( "Set Dictionary" ), QString::null, 0, this, NULL); | 290 | a = new QAction( tr( "Set Dictionary" ), QString::null, 0, this, NULL); |
@@ -257,2 +293,27 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
257 | 293 | ||
294 | a = new QAction( tr( "Two/One Touch" ), QString::null, 0, this, NULL, true ); | ||
295 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( setTwoTouch(bool) ) ); | ||
296 | a->setOn(m_twoTouch); | ||
297 | a->addTo( file ); | ||
298 | |||
299 | ag = new QActionGroup(this); | ||
300 | ag->setExclusive(false); | ||
301 | QPopupMenu *encoding = new QPopupMenu(this); | ||
302 | file->insertItem( tr( "Target" ), encoding ); | ||
303 | |||
304 | a = new QAction( tr( "Annotation" ), QString::null, 0, ag, NULL, true ); | ||
305 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( OnAnnotation(bool) ) ); | ||
306 | a->setOn(m_doAnnotation); | ||
307 | |||
308 | a = new QAction( tr( "Dictionary" ), QString::null, 0, ag, NULL, true ); | ||
309 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( OnDictionary(bool) ) ); | ||
310 | a->setOn(m_doDictionary); | ||
311 | |||
312 | a = new QAction( tr( "Clipboard" ), QString::null, 0, ag, NULL, true ); | ||
313 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( OnClipboard(bool) ) ); | ||
314 | a->setOn(m_doClipboard); | ||
315 | |||
316 | ag->addTo(encoding); | ||
317 | |||
318 | |||
258 | /* | 319 | /* |
@@ -278,6 +339,7 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
278 | 339 | ||
279 | a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 340 | // a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
341 | a = new QAction( tr( "Find..." ), QString::null, 0, this, NULL); | ||
280 | connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) ); | 342 | connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) ); |
281 | file->insertSeparator(); | 343 | file->insertSeparator(); |
282 | a->addTo( bar ); | 344 | // a->addTo( bar ); |
283 | a->addTo( file ); | 345 | a->addTo( file ); |
@@ -285,45 +347,83 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
285 | 347 | ||
286 | a = new QAction( tr( "Strip CR" ), QString::null, 0, this, NULL, true ); | 348 | a = m_bkmkAvail = new QAction( tr( "Annotation" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
287 | a->setOn(reader->bstripcr); | 349 | connect( a, SIGNAL( activated() ), this, SLOT( showAnnotation() ) ); |
288 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( stripcr(bool) ) ); | 350 | a->addTo( bar ); |
289 | a->addTo( format ); | 351 | |
290 | // a->setOn(true); | 352 | m_bkmkAvail->setEnabled(false); |
353 | |||
354 | |||
355 | ag = new QActionGroup(this); | ||
356 | // ag->setExclusive(false); | ||
357 | encoding = new QPopupMenu(this); | ||
358 | format->insertItem( tr( "Markup" ), encoding ); | ||
359 | |||
360 | a = new QAction( tr( "Auto" ), QString::null, 0, ag, NULL, true ); | ||
361 | a->setOn(reader->bautofmt); | ||
362 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( autofmt(bool) ) ); | ||
363 | |||
364 | a = new QAction( tr( "None" ), QString::null, 0, ag, NULL, true ); | ||
365 | a->setOn(!reader->bautofmt && !(reader->btextfmt || reader->bstriphtml || reader->bpeanut)); | ||
366 | // connect( a, SIGNAL( toggled(bool) ), this, SLOT( textfmt(bool) ) ); | ||
291 | 367 | ||
292 | a = new QAction( tr( "Strip HTML" ), QString::null, 0, this, NULL, true ); | 368 | a = new QAction( tr( "Text" ), QString::null, 0, ag, NULL, true ); |
369 | a->setOn(reader->btextfmt); | ||
370 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( textfmt(bool) ) ); | ||
371 | |||
372 | a = new QAction( tr( "HTML" ), QString::null, 0, ag, NULL, true ); | ||
293 | a->setOn(reader->bstriphtml); | 373 | a->setOn(reader->bstriphtml); |
294 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( striphtml(bool) ) ); | 374 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( striphtml(bool) ) ); |
295 | a->addTo( format ); | ||
296 | 375 | ||
297 | a = new QAction( tr( "Dehyphen" ), QString::null, 0, this, NULL, true ); | 376 | a = new QAction( tr( "Peanut/PML" ), QString::null, 0, ag, NULL, true ); |
377 | a->setOn(reader->bpeanut); | ||
378 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( peanut(bool) ) ); | ||
379 | |||
380 | ag->addTo(encoding); | ||
381 | |||
382 | |||
383 | |||
384 | ag = new QActionGroup(this); | ||
385 | ag->setExclusive(false); | ||
386 | encoding = new QPopupMenu(this); | ||
387 | format->insertItem( tr( "Layout" ), encoding ); | ||
388 | |||
389 | a = new QAction( tr( "Strip CR" ), QString::null, 0, ag, NULL, true ); | ||
390 | a->setOn(reader->bstripcr); | ||
391 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( stripcr(bool) ) ); | ||
392 | |||
393 | a = new QAction( tr( "Dehyphen" ), QString::null, 0, ag, NULL, true ); | ||
298 | a->setOn(reader->bdehyphen); | 394 | a->setOn(reader->bdehyphen); |
299 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( dehyphen(bool) ) ); | 395 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( dehyphen(bool) ) ); |
300 | a->addTo( format ); | 396 | // a->addTo( format ); |
301 | 397 | ||
302 | a = new QAction( tr( "Unindent" ), QString::null, 0, this, NULL, true ); | 398 | a = new QAction( tr( "Unindent" ), QString::null, 0, ag, NULL, true ); |
303 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( unindent(bool) ) ); | 399 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( unindent(bool) ) ); |
304 | a->setOn(reader->bunindent); | 400 | a->setOn(reader->bunindent); |
305 | a->addTo( format ); | 401 | // a->addTo( format ); |
306 | 402 | ||
307 | a = new QAction( tr( "Re-paragraph" ), QString::null, 0, this, NULL, true ); | 403 | a = new QAction( tr( "Re-paragraph" ), QString::null, 0, ag, NULL, true ); |
308 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( repara(bool) ) ); | 404 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( repara(bool) ) ); |
309 | a->setOn(reader->brepara); | 405 | a->setOn(reader->brepara); |
310 | a->addTo( format ); | 406 | // a->addTo( format ); |
311 | 407 | ||
312 | a = new QAction( tr( "Double Space" ), QString::null, 0, this, NULL, true ); | 408 | a = new QAction( tr( "Double Space" ), QString::null, 0, ag, NULL, true ); |
313 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( dblspce(bool) ) ); | 409 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( dblspce(bool) ) ); |
314 | a->setOn(reader->bdblspce); | 410 | a->setOn(reader->bdblspce); |
315 | a->addTo( format ); | 411 | // a->addTo( format ); |
316 | 412 | ||
317 | a = new QAction( tr( "Indent+" ), QString::null, 0, this, NULL ); | 413 | a = new QAction( tr( "Indent+" ), QString::null, 0, ag, NULL ); |
318 | connect( a, SIGNAL( activated() ), this, SLOT( indentplus() ) ); | 414 | connect( a, SIGNAL( activated() ), this, SLOT( indentplus() ) ); |
319 | a->addTo( format ); | 415 | // a->addTo( format ); |
320 | 416 | ||
321 | a = new QAction( tr( "Indent-" ), QString::null, 0, this, NULL ); | 417 | a = new QAction( tr( "Indent-" ), QString::null, 0, ag, NULL ); |
322 | connect( a, SIGNAL( activated() ), this, SLOT( indentminus() ) ); | 418 | connect( a, SIGNAL( activated() ), this, SLOT( indentminus() ) ); |
323 | a->addTo( format ); | ||
324 | 419 | ||
325 | a = new QAction( tr( "Bold" ), QString::null, 0, this, NULL, true ); | 420 | a = new QAction( tr( "Remap" ), QString::null, 0, ag, NULL, true ); |
326 | a->setOn(reader->m_bBold); | 421 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( remap(bool) ) ); |
327 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( setbold(bool) ) ); | 422 | a->setOn(reader->bremap); |
328 | a->addTo( format ); | 423 | |
424 | a = new QAction( tr( "Embolden" ), QString::null, 0, ag, NULL, true ); | ||
425 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( embolden(bool) ) ); | ||
426 | a->setOn(reader->bmakebold); | ||
427 | |||
428 | ag->addTo(encoding); | ||
329 | 429 | ||
@@ -348,7 +448,7 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
348 | 448 | ||
349 | QPopupMenu *encoding = new QPopupMenu(this); | 449 | encoding = new QPopupMenu(this); |
350 | format->insertSeparator(); | 450 | // format->insertSeparator(); |
351 | format->insertItem( tr( "Encoding" ), encoding ); | 451 | format->insertItem( tr( "Encoding" ), encoding ); |
352 | 452 | ||
353 | QActionGroup* ag = new QActionGroup(this); | 453 | ag = new QActionGroup(this); |
354 | 454 | ||
@@ -381,2 +481,6 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
381 | 481 | ||
482 | a = new QAction( tr( "Annotate" ), QString::null, 0, this, NULL); | ||
483 | connect( a, SIGNAL( activated() ), this, SLOT( addanno() ) ); | ||
484 | a->addTo( marks ); | ||
485 | |||
382 | a = new QAction( tr( "Goto" ), QString::null, 0, this, NULL, false ); | 486 | a = new QAction( tr( "Goto" ), QString::null, 0, this, NULL, false ); |
@@ -407,2 +511,12 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
407 | 511 | ||
512 | a = new QAction( tr( "Start Block" ), QString::null, 0, this, NULL); | ||
513 | connect( a, SIGNAL( activated() ), this, SLOT( editMark() ) ); | ||
514 | marks->insertSeparator(); | ||
515 | a->addTo( marks ); | ||
516 | |||
517 | a = new QAction( tr( "Copy Block" ), QString::null, 0, this, NULL); | ||
518 | connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); | ||
519 | a->addTo( marks ); | ||
520 | |||
521 | |||
408 | mb->insertItem( tr( "File" ), file ); | 522 | mb->insertItem( tr( "File" ), file ); |
@@ -412,3 +526,3 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
412 | 526 | ||
413 | searchBar = new QToolBar( "Search", this, QMainWindow::Top, TRUE ); | 527 | searchBar = new QFloatBar( "Search", this, QMainWindow::Top, TRUE ); |
414 | 528 | ||
@@ -416,2 +530,4 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
416 | 530 | ||
531 | connect(searchBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); | ||
532 | |||
417 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 533 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
@@ -420,2 +536,3 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
420 | searchBar->setStretchableWidget( searchEdit ); | 536 | searchBar->setStretchableWidget( searchEdit ); |
537 | |||
421 | #ifdef __ISEARCH | 538 | #ifdef __ISEARCH |
@@ -437,3 +554,4 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
437 | 554 | ||
438 | regBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE ); | 555 | regBar = new QFloatBar( "Autogen", this, QMainWindow::Top, TRUE ); |
556 | connect(regBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); | ||
439 | 557 | ||
@@ -467,4 +585,17 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
467 | FontDatabase f; | 585 | FontDatabase f; |
468 | m_fontSelector->insertStringList(f.families()); | 586 | QStringList flist = f.families(); |
587 | m_fontSelector->insertStringList(flist); | ||
588 | |||
589 | bool realfont = false; | ||
590 | for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) | ||
591 | { | ||
592 | if (reader->m_fontname == *nm) | ||
593 | { | ||
594 | realfont = true; | ||
595 | break; | ||
596 | } | ||
597 | } | ||
598 | if (!realfont) reader->m_fontname = flist[0]; | ||
469 | } // delete the FontDatabase!!! | 599 | } // delete the FontDatabase!!! |
600 | |||
470 | connect( m_fontSelector, SIGNAL( activated(const QString& ) ), | 601 | connect( m_fontSelector, SIGNAL( activated(const QString& ) ), |
@@ -479,2 +610,3 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
479 | 610 | ||
611 | reader->init(); | ||
480 | if (!reader->m_lastfile.isEmpty()) | 612 | if (!reader->m_lastfile.isEmpty()) |
@@ -485,2 +617,3 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
485 | m_EncodingAction[reader->m_encd]->setOn(true); | 617 | m_EncodingAction[reader->m_encd]->setOn(true); |
618 | m_buttonAction[m_spaceTarget]->setOn(true); | ||
486 | do_setfont(reader->m_fontname); | 619 | do_setfont(reader->m_fontname); |
@@ -500,3 +633,4 @@ void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data) | |||
500 | QMessageBox::information(this, "QTReader", info); | 633 | QMessageBox::information(this, "QTReader", info); |
501 | } else if ( msg == "warn(QString)" ) | 634 | } |
635 | else if ( msg == "warn(QString)" ) | ||
502 | { | 636 | { |
@@ -506,2 +640,238 @@ void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data) | |||
506 | } | 640 | } |
641 | |||
642 | |||
643 | else if ( msg == "exit()" ) | ||
644 | { | ||
645 | m_dontSave = true; | ||
646 | close(); | ||
647 | } | ||
648 | else if ( msg == "pageDown()" ) | ||
649 | { | ||
650 | reader->dopagedn(); | ||
651 | } | ||
652 | else if ( msg == "pageUp()" ) | ||
653 | { | ||
654 | reader->dopageup(); | ||
655 | } | ||
656 | else if ( msg == "lineDown()" ) | ||
657 | { | ||
658 | reader->lineDown(); | ||
659 | } | ||
660 | else if ( msg == "lineUp()" ) | ||
661 | { | ||
662 | reader->lineUp(); | ||
663 | } | ||
664 | else if ( msg == "showText()" ) | ||
665 | { | ||
666 | showEditTools(); | ||
667 | } | ||
668 | else if ( msg == "File/Open(QString)" ) | ||
669 | { | ||
670 | QString info; | ||
671 | stream >> info; | ||
672 | openFile( info ); | ||
673 | } | ||
674 | else if ( msg == "File/Info()" ) | ||
675 | { | ||
676 | showinfo(); | ||
677 | } | ||
678 | else if ( msg == "File/Start Block()" ) | ||
679 | { | ||
680 | editMark(); | ||
681 | } | ||
682 | else if ( msg == "File/Copy Block()" ) | ||
683 | { | ||
684 | editCopy(); | ||
685 | } | ||
686 | else if ( msg == "File/Scroll(int)" ) | ||
687 | { | ||
688 | int info; | ||
689 | stream >> info; | ||
690 | autoScroll(info); | ||
691 | } | ||
692 | else if ( msg == "File/Jump(int)" ) | ||
693 | { | ||
694 | int info; | ||
695 | stream >> info; | ||
696 | reader->locate(info); | ||
697 | } | ||
698 | else if ( msg == "File/Page/Line Scroll(int)" ) | ||
699 | { | ||
700 | int info; | ||
701 | stream >> info; | ||
702 | pagemode(info); | ||
703 | } | ||
704 | else if ( msg == "File/Set Overlap(int)" ) | ||
705 | { | ||
706 | int info; | ||
707 | stream >> info; | ||
708 | reader->m_overlap = info; | ||
709 | } | ||
710 | else if ( msg == "File/Set Dictionary(QString)" ) | ||
711 | { | ||
712 | QString info; | ||
713 | stream >> info; | ||
714 | do_settarget(info); | ||
715 | } | ||
716 | else if ( msg == "File/Two/One Touch(int)" ) | ||
717 | { | ||
718 | int info; | ||
719 | stream >> info; | ||
720 | setTwoTouch(info); | ||
721 | } | ||
722 | else if ( msg == "Target/Annotation(int)" ) | ||
723 | { | ||
724 | int info; | ||
725 | stream >> info; | ||
726 | OnAnnotation(info); | ||
727 | } | ||
728 | else if ( msg == "Target/Dictionary(int)" ) | ||
729 | { | ||
730 | int info; | ||
731 | stream >> info; | ||
732 | OnDictionary(info); | ||
733 | } | ||
734 | else if ( msg == "Target/Clipboard(int)" ) | ||
735 | { | ||
736 | int info; | ||
737 | stream >> info; | ||
738 | OnClipboard(info); | ||
739 | } | ||
740 | else if ( msg == "File/Find(QString)" ) | ||
741 | { | ||
742 | QString info; | ||
743 | stream >> info; | ||
744 | QRegExp arg(info); | ||
745 | size_t pos = reader->pagelocate(); | ||
746 | size_t start = pos; | ||
747 | CDrawBuffer test(&(reader->m_fontControl)); | ||
748 | reader->buffdoc.getline(&test,reader->width()); | ||
749 | while (arg.match(toQString(test.data())) == -1) | ||
750 | { | ||
751 | pos = reader->locate(); | ||
752 | if (!reader->buffdoc.getline(&test,reader->width())) | ||
753 | { | ||
754 | QMessageBox::information(this, "QTReader", QString("Can't find\n")+info); | ||
755 | pos = start; | ||
756 | break; | ||
757 | } | ||
758 | } | ||
759 | reader->locate(pos); | ||
760 | } | ||
761 | else if ( msg == "Layout/Strip CR(int)" ) | ||
762 | { | ||
763 | int info; | ||
764 | stream >> info; | ||
765 | stripcr(info); | ||
766 | } | ||
767 | else if ( msg == "Markup/Auto(int)" ) | ||
768 | { | ||
769 | int info; | ||
770 | stream >> info; | ||
771 | autofmt(info); | ||
772 | } | ||
773 | else if ( msg == "Markup/Text(int)" ) | ||
774 | { | ||
775 | int info; | ||
776 | stream >> info; | ||
777 | textfmt(info); | ||
778 | } | ||
779 | else if ( msg == "Markup/HTML(int)" ) | ||
780 | { | ||
781 | int info; | ||
782 | stream >> info; | ||
783 | striphtml(info); | ||
784 | } | ||
785 | else if ( msg == "Markup/Peanut(int)" ) | ||
786 | { | ||
787 | int info; | ||
788 | stream >> info; | ||
789 | peanut(info); | ||
790 | } | ||
791 | else if ( msg == "Layout/Dehyphen(int)" ) | ||
792 | { | ||
793 | int info; | ||
794 | stream >> info; | ||
795 | dehyphen(info); | ||
796 | } | ||
797 | else if ( msg == "Layout/Unindent(int)" ) | ||
798 | { | ||
799 | int info; | ||
800 | stream >> info; | ||
801 | unindent(info); | ||
802 | } | ||
803 | else if ( msg == "Layout/Re-paragraph(int)" ) | ||
804 | { | ||
805 | int info; | ||
806 | stream >> info; | ||
807 | repara(info); | ||
808 | } | ||
809 | else if ( msg == "Layout/Double Space(int)" ) | ||
810 | { | ||
811 | int info; | ||
812 | stream >> info; | ||
813 | dblspce(info); | ||
814 | } | ||
815 | else if ( msg == "Layout/Indent(int)" ) | ||
816 | { | ||
817 | int info; | ||
818 | stream >> info; | ||
819 | reader->bindenter = info; | ||
820 | reader->setfilter(reader->getfilter()); | ||
821 | } | ||
822 | else if ( msg == "Layout/Remap(int)" ) | ||
823 | { | ||
824 | int info; | ||
825 | stream >> info; | ||
826 | remap(info); | ||
827 | } | ||
828 | else if ( msg == "Layout/Embolden(int)" ) | ||
829 | { | ||
830 | int info; | ||
831 | stream >> info; | ||
832 | embolden(info); | ||
833 | } | ||
834 | else if ( msg == "Format/Ideogram/Word(int)" ) | ||
835 | { | ||
836 | int info; | ||
837 | stream >> info; | ||
838 | monospace(info); | ||
839 | } | ||
840 | else if ( msg == "Format/Set width(int)" ) | ||
841 | { | ||
842 | int info; | ||
843 | stream >> info; | ||
844 | reader->m_charpc = info; | ||
845 | reader->setfont(); | ||
846 | reader->refresh(); | ||
847 | } | ||
848 | else if ( msg == "Format/Encoding(QString)" ) | ||
849 | { | ||
850 | QString info; | ||
851 | stream >> info; | ||
852 | reader->setencoding(EncNameToInt(info)); | ||
853 | } | ||
854 | else if ( msg == "Format/Set Font(QString,int)" ) | ||
855 | { | ||
856 | QString fontname; | ||
857 | int size; | ||
858 | stream >> fontname; | ||
859 | stream >> size; | ||
860 | setfontHelper(fontname, size); | ||
861 | } | ||
862 | else if ( msg == "Marks/Autogen(QString)" ) | ||
863 | { | ||
864 | QString info; | ||
865 | stream >> info; | ||
866 | do_autogen(info); | ||
867 | } | ||
868 | } | ||
869 | |||
870 | ActionTypes QTReaderApp::ActNameToInt(const QString& _enc) | ||
871 | { | ||
872 | for (int i = 0; i < MAX_ACTIONS; i++) | ||
873 | { | ||
874 | if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i; | ||
875 | } | ||
876 | return cesAutoScroll; | ||
507 | } | 877 | } |
@@ -529,2 +899,8 @@ void QTReaderApp::encodingSelected(QAction* _a) | |||
529 | 899 | ||
900 | void QTReaderApp::buttonActionSelected(QAction* _a) | ||
901 | { | ||
902 | // qDebug("es:%x : %s (%u)", _a, (const char *)(_a->text()), ActNameToInt(_a->text())); | ||
903 | m_spaceTarget = ActNameToInt(_a->text()); | ||
904 | } | ||
905 | |||
530 | QTReaderApp::~QTReaderApp() | 906 | QTReaderApp::~QTReaderApp() |
@@ -591,2 +967,3 @@ void QTReaderApp::fileOpen() | |||
591 | delete fb; | 967 | delete fb; |
968 | reader->setFocus(); | ||
592 | } | 969 | } |
@@ -614,2 +991,103 @@ void QTReaderApp::showinfo() | |||
614 | 991 | ||
992 | void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn) | ||
993 | { | ||
994 | if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>; | ||
995 | #ifdef _UNICODE | ||
996 | CBuffer buff(name.length()+1); | ||
997 | int i; | ||
998 | for (i = 0; i < name.length(); i++) | ||
999 | { | ||
1000 | buff[i] = name[i].unicode(); | ||
1001 | } | ||
1002 | buff[i] = 0; | ||
1003 | CBuffer buff2(text.length()+1); | ||
1004 | for (i = 0; i < text.length(); i++) | ||
1005 | { | ||
1006 | buff2[i] = text[i].unicode(); | ||
1007 | } | ||
1008 | buff2[i] = 0; | ||
1009 | pBkmklist->push_front(Bkmk(buff.data(), buff2.data(), posn)); | ||
1010 | #else | ||
1011 | pBkmklist->push_front(Bkmk((const tchar*)text,posn)); | ||
1012 | #endif | ||
1013 | m_fBkmksChanged = true; | ||
1014 | pBkmklist->sort(); | ||
1015 | } | ||
1016 | |||
1017 | void QTReaderApp::addAnno(const QString& name, const QString& text) | ||
1018 | { | ||
1019 | if (m_annoIsEditing) | ||
1020 | { | ||
1021 | if (name.isEmpty()) | ||
1022 | { | ||
1023 | QMessageBox::information(this, "QTReader", "Need a name for the bookmark\nPlease try again", 1); | ||
1024 | } | ||
1025 | else | ||
1026 | { | ||
1027 | addAnno(name, text, m_annoWin->getPosn()); | ||
1028 | } | ||
1029 | showEditTools(); | ||
1030 | } | ||
1031 | else | ||
1032 | { | ||
1033 | if (m_annoWin->edited()) | ||
1034 | { | ||
1035 | CBuffer buff(text.length()+1); | ||
1036 | int i; | ||
1037 | for (i = 0; i < text.length(); i++) | ||
1038 | { | ||
1039 | buff[i] = text[i].unicode(); | ||
1040 | } | ||
1041 | buff[i] = 0; | ||
1042 | m_fBkmksChanged = true; | ||
1043 | m_anno->setAnno(buff.data()); | ||
1044 | } | ||
1045 | bool found = findNextBookmark(m_anno->value()+1); | ||
1046 | if (found) | ||
1047 | { | ||
1048 | m_annoWin->setName(toQString(m_anno->name())); | ||
1049 | m_annoWin->setAnno(toQString(m_anno->anno())); | ||
1050 | } | ||
1051 | else | ||
1052 | { | ||
1053 | showEditTools(); | ||
1054 | } | ||
1055 | } | ||
1056 | } | ||
1057 | |||
1058 | bool QTReaderApp::findNextBookmark(size_t start) | ||
1059 | { | ||
1060 | bool found = false; | ||
1061 | for (CList<Bkmk>::iterator iter = pBkmklist->begin(); iter != pBkmklist->end(); iter++) | ||
1062 | { | ||
1063 | if (iter->value() >= start) | ||
1064 | { | ||
1065 | if (iter->value() < reader->locate()) | ||
1066 | { | ||
1067 | found = true; | ||
1068 | m_anno = iter.pContent(); | ||
1069 | } | ||
1070 | break; | ||
1071 | } | ||
1072 | } | ||
1073 | return found; | ||
1074 | } | ||
1075 | |||
1076 | void QTReaderApp::addanno() | ||
1077 | { | ||
1078 | if (reader->empty()) | ||
1079 | { | ||
1080 | QMessageBox::information(this, "QTReader", "No file loaded", 1); | ||
1081 | } | ||
1082 | else | ||
1083 | { | ||
1084 | m_annoWin->setName(""); | ||
1085 | m_annoWin->setAnno(""); | ||
1086 | m_annoWin->setPosn(reader->pagelocate()); | ||
1087 | m_annoIsEditing = true; | ||
1088 | editorStack->raiseWidget( m_annoWin ); | ||
1089 | m_annoWin->setFocus(); | ||
1090 | } | ||
1091 | } | ||
1092 | |||
615 | void QTReaderApp::infoClose() | 1093 | void QTReaderApp::infoClose() |
@@ -646,3 +1124,3 @@ void QTReaderApp::editCopy() | |||
646 | reader->jumpto(m_savedpos); | 1124 | reader->jumpto(m_savedpos); |
647 | while (reader->locate() < endpos && (ch = reader->getch()) != UEOF) | 1125 | while (reader->explocate() < endpos && (ch = reader->getch()) != UEOF) |
648 | { | 1126 | { |
@@ -651,10 +1129,3 @@ void QTReaderApp::editCopy() | |||
651 | cb->setText(text); | 1129 | cb->setText(text); |
652 | // text = cb->text(); | ||
653 | // if (text) | ||
654 | // qDebug("The clipboard contains: %s", (const tchar*)text); | ||
655 | reader->locate(currentpos); | 1130 | reader->locate(currentpos); |
656 | #ifndef QT_NO_CLIPBOARD | ||
657 | // TBD(); | ||
658 | // reader->copy(); | ||
659 | #endif | ||
660 | } | 1131 | } |
@@ -675,2 +1146,22 @@ void QTReaderApp::stripcr(bool _b) | |||
675 | } | 1146 | } |
1147 | void QTReaderApp::remap(bool _b) | ||
1148 | { | ||
1149 | reader->setremap(_b); | ||
1150 | } | ||
1151 | void QTReaderApp::peanut(bool _b) | ||
1152 | { | ||
1153 | reader->setpeanut(_b); | ||
1154 | } | ||
1155 | void QTReaderApp::embolden(bool _b) | ||
1156 | { | ||
1157 | reader->setmakebold(_b); | ||
1158 | } | ||
1159 | void QTReaderApp::autofmt(bool _b) | ||
1160 | { | ||
1161 | reader->setautofmt(_b); | ||
1162 | } | ||
1163 | void QTReaderApp::textfmt(bool _b) | ||
1164 | { | ||
1165 | reader->settextfmt(_b); | ||
1166 | } | ||
676 | void QTReaderApp::striphtml(bool _b) | 1167 | void QTReaderApp::striphtml(bool _b) |
@@ -691,8 +1182,2 @@ void QTReaderApp::repara(bool _b) | |||
691 | } | 1182 | } |
692 | void QTReaderApp::setbold(bool _b) | ||
693 | { | ||
694 | reader->m_bBold = _b; | ||
695 | reader->ChangeFont(reader->fontsizes[reader->m_textsize]); | ||
696 | reader->refresh(); | ||
697 | } | ||
698 | void QTReaderApp::dblspce(bool _b) | 1183 | void QTReaderApp::dblspce(bool _b) |
@@ -732,5 +1217,5 @@ void QTReaderApp::settarget() | |||
732 | m_nRegAction = cSetTarget; | 1217 | m_nRegAction = cSetTarget; |
733 | QString text = ((reader->m_targetapp.isEmpty()) ? QString("") : reader->m_targetapp) | 1218 | QString text = ((m_targetapp.isEmpty()) ? QString("") : m_targetapp) |
734 | + "/" | 1219 | + "/" |
735 | + ((reader->m_targetmsg.isEmpty()) ? QString("") : reader->m_targetmsg); | 1220 | + ((m_targetmsg.isEmpty()) ? QString("") : m_targetmsg); |
736 | regEdit->setText(text); | 1221 | regEdit->setText(text); |
@@ -758,2 +1243,4 @@ void QTReaderApp::do_mono(const QString& lcn) | |||
758 | reader->m_charpc = ulcn; | 1243 | reader->m_charpc = ulcn; |
1244 | reader->setfont(); | ||
1245 | reader->refresh(); | ||
759 | // reader->setmono(true); | 1246 | // reader->setmono(true); |
@@ -795,3 +1282,3 @@ void QTReaderApp::findNext() | |||
795 | #endif | 1282 | #endif |
796 | CBuffer test; | 1283 | CDrawBuffer test(&(reader->m_fontControl)); |
797 | size_t start = reader->pagelocate(); | 1284 | size_t start = reader->pagelocate(); |
@@ -827,5 +1314,5 @@ void QTReaderApp::regClose() | |||
827 | #ifdef __ISEARCH | 1314 | #ifdef __ISEARCH |
828 | bool QTReaderApp::dosearch(size_t start, CBuffer& test, const QString& arg) | 1315 | bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QString& arg) |
829 | #else | 1316 | #else |
830 | bool QTReaderApp::dosearch(size_t start, CBuffer& test, const QRegExp& arg) | 1317 | bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg) |
831 | #endif | 1318 | #endif |
@@ -833,3 +1320,3 @@ bool QTReaderApp::dosearch(size_t start, CBuffer& test, const QRegExp& arg) | |||
833 | bool ret = true; | 1320 | bool ret = true; |
834 | size_t pos = start; | 1321 | size_t pos = reader->locate(); |
835 | reader->buffdoc.getline(&test,reader->width()); | 1322 | reader->buffdoc.getline(&test,reader->width()); |
@@ -897,7 +1384,3 @@ void QTReaderApp::search() | |||
897 | { | 1384 | { |
898 | QRegExp arg = searchEdit->text(); | 1385 | findNext(); |
899 | CBuffer test; | ||
900 | size_t start = reader->pagelocate(); | ||
901 | // reader->jumpto(start); | ||
902 | dosearch(start, test, arg); | ||
903 | } | 1386 | } |
@@ -947,3 +1430,3 @@ void QTReaderApp::showEditTools() | |||
947 | // fileSelector->hide(); | 1430 | // fileSelector->hide(); |
948 | menu->show(); | 1431 | //tjw menu->show(); |
949 | editBar->show(); | 1432 | editBar->show(); |
@@ -1005,3 +1488,3 @@ void QTReaderApp::updateCaption() | |||
1005 | if ( !doc ) | 1488 | if ( !doc ) |
1006 | setCaption( tr("Opie Reader") ); | 1489 | setCaption( tr("QTReader") ); |
1007 | else { | 1490 | else { |
@@ -1010,3 +1493,3 @@ void QTReaderApp::updateCaption() | |||
1010 | s = tr( "Unnamed" ); | 1493 | s = tr( "Unnamed" ); |
1011 | setCaption( s + " - " + tr("Opie Reader") ); | 1494 | setCaption( s + " - " + tr("QTReader") ); |
1012 | } | 1495 | } |
@@ -1024,2 +1507,8 @@ void QTReaderApp::closeEvent( QCloseEvent *e ) | |||
1024 | { | 1507 | { |
1508 | if (m_dontSave) | ||
1509 | { | ||
1510 | e->accept(); | ||
1511 | } | ||
1512 | else | ||
1513 | { | ||
1025 | if (editorStack->visibleWidget() == reader) | 1514 | if (editorStack->visibleWidget() == reader) |
@@ -1060,2 +1549,3 @@ void QTReaderApp::closeEvent( QCloseEvent *e ) | |||
1060 | } | 1549 | } |
1550 | } | ||
1061 | 1551 | ||
@@ -1079,3 +1569,2 @@ void QTReaderApp::listbkmk() | |||
1079 | { | 1569 | { |
1080 | if (m_fBkmksChanged) pBkmklist->sort(); | ||
1081 | for (CList<Bkmk>::iterator i = pBkmklist->begin(); i != pBkmklist->end(); i++) | 1570 | for (CList<Bkmk>::iterator i = pBkmklist->begin(); i != pBkmklist->end(); i++) |
@@ -1092,3 +1581,3 @@ void QTReaderApp::listbkmk() | |||
1092 | { | 1581 | { |
1093 | menu->hide(); | 1582 | //tjw menu->hide(); |
1094 | editBar->hide(); | 1583 | editBar->hide(); |
@@ -1129,2 +1618,3 @@ void QTReaderApp::gotobkmk(int ind) | |||
1129 | m_fBkmksChanged = true; | 1618 | m_fBkmksChanged = true; |
1619 | // pBkmklist->sort(); | ||
1130 | break; | 1620 | break; |
@@ -1196,4 +1686,4 @@ void QTReaderApp::do_settarget(const QString& _txt) | |||
1196 | { | 1686 | { |
1197 | reader->m_targetapp = ""; | 1687 | m_targetapp = ""; |
1198 | reader->m_targetmsg = ""; | 1688 | m_targetmsg = ""; |
1199 | QMessageBox::information(this, "QTReader", "Format is\nappname/messagename"); | 1689 | QMessageBox::information(this, "QTReader", "Format is\nappname/messagename"); |
@@ -1202,4 +1692,4 @@ void QTReaderApp::do_settarget(const QString& _txt) | |||
1202 | { | 1692 | { |
1203 | reader->m_targetapp = _txt.left(ind); | 1693 | m_targetapp = _txt.left(ind); |
1204 | reader->m_targetmsg = _txt.right(_txt.length()-ind-1); | 1694 | m_targetmsg = _txt.right(_txt.length()-ind-1); |
1205 | } | 1695 | } |
@@ -1221,4 +1711,5 @@ void QTReaderApp::setfont() | |||
1221 | 1711 | ||
1222 | void QTReaderApp::do_setfont(const QString& lcn) | 1712 | void QTReaderApp::setfontHelper(const QString& lcn, int size = 0) |
1223 | { | 1713 | { |
1714 | if (size == 0) size = reader->m_fontControl.currentsize(); | ||
1224 | QFont f(lcn, 10 /*, QFont::Bold*/); | 1715 | QFont f(lcn, 10 /*, QFont::Bold*/); |
@@ -1227,4 +1718,8 @@ void QTReaderApp::do_setfont(const QString& lcn) | |||
1227 | searchEdit->setFont( f ); | 1718 | searchEdit->setFont( f ); |
1719 | m_annoWin->setFont( f ); | ||
1228 | reader->m_fontname = lcn; | 1720 | reader->m_fontname = lcn; |
1229 | reader->ChangeFont(reader->fontsizes[reader->m_textsize]); | 1721 | if (!reader->ChangeFont(size)) |
1722 | { | ||
1723 | reader->ChangeFont(size); | ||
1724 | } | ||
1230 | reader->refresh(); | 1725 | reader->refresh(); |
@@ -1235,2 +1730,7 @@ void QTReaderApp::do_setfont(const QString& lcn) | |||
1235 | 1730 | ||
1731 | void QTReaderApp::do_setfont(const QString& lcn) | ||
1732 | { | ||
1733 | setfontHelper(lcn); | ||
1734 | } | ||
1735 | |||
1236 | void QTReaderApp::do_autogen(const QString& regText) | 1736 | void QTReaderApp::do_autogen(const QString& regText) |
@@ -1272,4 +1772,5 @@ pbar->resize(width(), editBar->height()); | |||
1272 | #endif | 1772 | #endif |
1273 | pBkmklist->push_back(Bkmk(buff.data(),lcn)); | 1773 | pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); |
1274 | } | 1774 | } |
1775 | pBkmklist->sort(); | ||
1275 | pbar->setProgress(100); | 1776 | pbar->setProgress(100); |
@@ -1288,2 +1789,4 @@ void QTReaderApp::saveprefs() | |||
1288 | config.writeEntry( "StripCr", reader->bstripcr ); | 1789 | config.writeEntry( "StripCr", reader->bstripcr ); |
1790 | config.writeEntry( "AutoFmt", reader->bautofmt ); | ||
1791 | config.writeEntry( "TextFmt", reader->btextfmt ); | ||
1289 | config.writeEntry( "StripHtml", reader->bstriphtml ); | 1792 | config.writeEntry( "StripHtml", reader->bstriphtml ); |
@@ -1294,4 +1797,3 @@ void QTReaderApp::saveprefs() | |||
1294 | config.writeEntry( "Indent", reader->bindenter ); | 1797 | config.writeEntry( "Indent", reader->bindenter ); |
1295 | config.writeEntry( "FontSize", (int)(reader->fontsizes[reader->m_textsize]) ); | 1798 | config.writeEntry( "FontSize", (int)(reader->m_fontControl.currentsize()) ); |
1296 | config.writeEntry( "Bold", reader->m_bBold ); | ||
1297 | config.writeEntry( "ScrollDelay", reader->m_delay); | 1799 | config.writeEntry( "ScrollDelay", reader->m_delay); |
@@ -1305,4 +1807,12 @@ void QTReaderApp::saveprefs() | |||
1305 | config.writeEntry( "Overlap", (int)(reader->m_overlap) ); | 1807 | config.writeEntry( "Overlap", (int)(reader->m_overlap) ); |
1306 | config.writeEntry( "TargetApp", reader->m_targetapp ); | 1808 | config.writeEntry( "TargetApp", m_targetapp ); |
1307 | config.writeEntry( "TargetMsg", reader->m_targetmsg ); | 1809 | config.writeEntry( "TargetMsg", m_targetmsg ); |
1810 | config.writeEntry( "TwoTouch", m_twoTouch ); | ||
1811 | config.writeEntry( "Annotation", m_doAnnotation); | ||
1812 | config.writeEntry( "Dictionary", m_doDictionary); | ||
1813 | config.writeEntry( "Clipboard", m_doClipboard); | ||
1814 | config.writeEntry( "SpaceTarget", m_spaceTarget); | ||
1815 | config.writeEntry( "Remap", reader->bremap ); | ||
1816 | config.writeEntry( "Peanut", reader->bpeanut ); | ||
1817 | config.writeEntry( "MakeBold", reader->bmakebold ); | ||
1308 | } | 1818 | } |
@@ -1393,3 +1903,3 @@ void QTReaderApp::readbkmks() | |||
1393 | pBkmklist = bf.readall(); | 1903 | pBkmklist = bf.readall(); |
1394 | m_fBkmksChanged = false; | 1904 | m_fBkmksChanged = bf.upgraded(); |
1395 | if (pBkmklist == NULL) | 1905 | if (pBkmklist == NULL) |
@@ -1426,3 +1936,3 @@ void QTReaderApp::do_addbkmk(const QString& text) | |||
1426 | buff[i] = 0; | 1936 | buff[i] = 0; |
1427 | pBkmklist->push_front(Bkmk(buff.data(), reader->pagelocate())); | 1937 | pBkmklist->push_front(Bkmk(buff.data(), NULL, reader->pagelocate())); |
1428 | #else | 1938 | #else |
@@ -1431,3 +1941,89 @@ void QTReaderApp::do_addbkmk(const QString& text) | |||
1431 | m_fBkmksChanged = true; | 1941 | m_fBkmksChanged = true; |
1942 | pBkmklist->sort(); | ||
1432 | } | 1943 | } |
1433 | } | 1944 | } |
1945 | |||
1946 | void QTReaderApp::OnRedraw() | ||
1947 | { | ||
1948 | if (pBkmklist != NULL) | ||
1949 | { | ||
1950 | bool found = findNextBookmark(reader->pagelocate()); | ||
1951 | m_bkmkAvail->setEnabled(found); | ||
1952 | } | ||
1953 | } | ||
1954 | |||
1955 | void QTReaderApp::showAnnotation() | ||
1956 | { | ||
1957 | m_annoWin->setName(toQString(m_anno->name())); | ||
1958 | m_annoWin->setAnno(toQString(m_anno->anno())); | ||
1959 | m_annoIsEditing = false; | ||
1960 | editorStack->raiseWidget( m_annoWin ); | ||
1961 | m_annoWin->setFocus(); | ||
1962 | } | ||
1963 | |||
1964 | void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, const QString& line) | ||
1965 | { | ||
1966 | // qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd); | ||
1967 | |||
1968 | if (m_doClipboard) | ||
1969 | { | ||
1970 | QClipboard* cb = QApplication::clipboard(); | ||
1971 | cb->setText(wrd); | ||
1972 | if (wrd.length() > 10) | ||
1973 | { | ||
1974 | Global::statusMessage(wrd.left(8) + ".."); | ||
1975 | } | ||
1976 | else | ||
1977 | { | ||
1978 | Global::statusMessage(wrd); | ||
1979 | } | ||
1980 | } | ||
1981 | if (m_doAnnotation) | ||
1982 | { | ||
1983 | //addAnno(wrd, "Need to be able to edit this", posn); | ||
1984 | m_annoWin->setName(line); | ||
1985 | m_annoWin->setAnno(""); | ||
1986 | m_annoWin->setPosn(posn); | ||
1987 | m_annoIsEditing = true; | ||
1988 | editorStack->raiseWidget( m_annoWin ); | ||
1989 | } | ||
1990 | if (m_doDictionary) | ||
1991 | { | ||
1992 | if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty()) | ||
1993 | { | ||
1994 | QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8()); | ||
1995 | e << wrd; | ||
1996 | } | ||
1997 | } | ||
1998 | } | ||
1999 | |||
2000 | void QTReaderApp::OnActionPressed() | ||
2001 | { | ||
2002 | switch (m_spaceTarget) | ||
2003 | { | ||
2004 | case cesOpenFile: | ||
2005 | { | ||
2006 | fileOpen(); | ||
2007 | } | ||
2008 | break; | ||
2009 | case cesAutoScroll: | ||
2010 | { | ||
2011 | reader->setautoscroll(!reader->m_autoScroll); | ||
2012 | setScrollState(reader->m_autoScroll); | ||
2013 | } | ||
2014 | break; | ||
2015 | case cesActionMark: | ||
2016 | { | ||
2017 | addbkmk(); | ||
2018 | } | ||
2019 | break; | ||
2020 | default: | ||
2021 | { | ||
2022 | qDebug("Unknown ActionType:%u", m_spaceTarget); | ||
2023 | } | ||
2024 | break; | ||
2025 | } | ||
2026 | } | ||
2027 | |||
2028 | void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); } | ||
2029 | void QTReaderApp::restoreFocus() { reader->setFocus(); } | ||