author | llornkcor <llornkcor> | 2002-07-01 23:53:13 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-07-01 23:53:13 (UTC) |
commit | 947bd80f93998f75378db1d677b85eb121c10a1d (patch) (unidiff) | |
tree | 9559208fb4c5f5aa31e1f354415f91e95175ca4d /noncore/apps | |
parent | 7ae4965a4052808172e843356cdfb2d0a673bccf (diff) | |
download | opie-947bd80f93998f75378db1d677b85eb121c10a1d.zip opie-947bd80f93998f75378db1d677b85eb121c10a1d.tar.gz opie-947bd80f93998f75378db1d677b85eb121c10a1d.tar.bz2 |
changed caption and added cvsigonre
-rw-r--r-- | noncore/apps/opie-reader/.cvsignore | 3 | ||||
-rw-r--r-- | noncore/apps/opie-reader/QTReaderApp.cpp | 470 |
2 files changed, 238 insertions, 235 deletions
diff --git a/noncore/apps/opie-reader/.cvsignore b/noncore/apps/opie-reader/.cvsignore new file mode 100644 index 0000000..5344d1b --- a/dev/null +++ b/noncore/apps/opie-reader/.cvsignore | |||
@@ -0,0 +1,3 @@ | |||
1 | Makefile | ||
2 | Makefile.in | ||
3 | moc* \ No newline at end of file | ||
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp index 620e93e..06a35f6 100644 --- a/noncore/apps/opie-reader/QTReaderApp.cpp +++ b/noncore/apps/opie-reader/QTReaderApp.cpp | |||
@@ -47,90 +47,90 @@ | |||
47 | #include <qpe/resource.h> | 47 | #include <qpe/resource.h> |
48 | #include <qpe/qpeapplication.h> | 48 | #include <qpe/qpeapplication.h> |
49 | 49 | ||
50 | #include "QTReaderApp.h" | 50 | #include "QTReaderApp.h" |
51 | #include "fileBrowser.h" | 51 | #include "fileBrowser.h" |
52 | 52 | ||
53 | 53 | ||
54 | unsigned long QTReaderApp::m_uid = 0; | 54 | unsigned long QTReaderApp::m_uid = 0; |
55 | 55 | ||
56 | void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); } | 56 | void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); } |
57 | 57 | ||
58 | #include <unistd.h> | 58 | #include <unistd.h> |
59 | #include <stddef.h> | 59 | #include <stddef.h> |
60 | #include <dirent.h> | 60 | #include <dirent.h> |
61 | 61 | ||
62 | void QTReaderApp::listBkmkFiles() | 62 | void QTReaderApp::listBkmkFiles() |
63 | { | 63 | { |
64 | bkmkselector->clear(); | 64 | bkmkselector->clear(); |
65 | int cnt = 0; | 65 | int cnt = 0; |
66 | DIR *d; | 66 | DIR *d; |
67 | d = opendir((const char *)Global::applicationFileName("uqtreader","")); | 67 | d = opendir((const char *)Global::applicationFileName("uqtreader","")); |
68 | 68 | ||
69 | while(1) | 69 | while(1) |
70 | { | 70 | { |
71 | struct dirent* de; | 71 | struct dirent* de; |
72 | struct stat buf; | 72 | struct stat buf; |
73 | de = readdir(d); | 73 | de = readdir(d); |
74 | if (de == NULL) break; | 74 | if (de == NULL) break; |
75 | 75 | ||
76 | if (lstat((const char *)Global::applicationFileName("uqtreader",de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) | 76 | if (lstat((const char *)Global::applicationFileName("uqtreader",de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) |
77 | { | 77 | { |
78 | bkmkselector->insertItem(de->d_name); | 78 | bkmkselector->insertItem(de->d_name); |
79 | cnt++; | 79 | cnt++; |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | closedir(d); | 83 | closedir(d); |
84 | 84 | ||
85 | if (cnt > 0) | 85 | if (cnt > 0) |
86 | { | 86 | { |
87 | menu->hide(); | 87 | menu->hide(); |
88 | editBar->hide(); | 88 | editBar->hide(); |
89 | if (m_fontVisible) m_fontBar->hide(); | 89 | if (m_fontVisible) m_fontBar->hide(); |
90 | if (regVisible) regBar->hide(); | 90 | if (regVisible) regBar->hide(); |
91 | if (searchVisible) searchBar->hide(); | 91 | if (searchVisible) searchBar->hide(); |
92 | m_nRegAction = cRmBkmkFile; | 92 | m_nRegAction = cRmBkmkFile; |
93 | editorStack->raiseWidget( bkmkselector ); | 93 | editorStack->raiseWidget( bkmkselector ); |
94 | } | 94 | } |
95 | else | 95 | else |
96 | QMessageBox::information(this, "QTReader", "No bookmark files"); | 96 | QMessageBox::information(this, "QTReader", "No bookmark files"); |
97 | } | 97 | } |
98 | 98 | ||
99 | QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | 99 | QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) |
100 | : QMainWindow( parent, name, f ), bFromDocView( FALSE ) | 100 | : QMainWindow( parent, name, f ), bFromDocView( FALSE ) |
101 | { | 101 | { |
102 | // qDebug("Application directory = %s", (const tchar *)QPEApplication::documentDir()); | 102 | // qDebug("Application directory = %s", (const tchar *)QPEApplication::documentDir()); |
103 | // qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml")); | 103 | // qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml")); |
104 | 104 | ||
105 | pBkmklist = NULL; | 105 | pBkmklist = NULL; |
106 | doc = 0; | 106 | doc = 0; |
107 | 107 | ||
108 | m_fBkmksChanged = false; | 108 | m_fBkmksChanged = false; |
109 | 109 | ||
110 | QString lang = getenv( "LANG" ); | 110 | QString lang = getenv( "LANG" ); |
111 | 111 | ||
112 | m_autogenstr = "^ *[A-Z].*[a-z] *$"; | 112 | m_autogenstr = "^ *[A-Z].*[a-z] *$"; |
113 | setToolBarsMovable( FALSE ); | 113 | setToolBarsMovable( FALSE ); |
114 | 114 | ||
115 | setIcon( Resource::loadPixmap( "uqtreader" ) ); | 115 | setIcon( Resource::loadPixmap( "uqtreader" ) ); |
116 | 116 | ||
117 | QPEToolBar *bar = new QPEToolBar( this ); | 117 | QPEToolBar *bar = new QPEToolBar( this ); |
118 | bar->setHorizontalStretchable( TRUE ); | 118 | bar->setHorizontalStretchable( TRUE ); |
119 | addToolBar(bar, "tool",QMainWindow::Top, true); | 119 | addToolBar(bar, "tool",QMainWindow::Top, true); |
120 | menu = bar; | 120 | menu = bar; |
121 | 121 | ||
122 | QPEMenuBar *mb = new QPEMenuBar( bar ); | 122 | QPEMenuBar *mb = new QPEMenuBar( bar ); |
123 | QPopupMenu *file = new QPopupMenu( this ); | 123 | QPopupMenu *file = new QPopupMenu( this ); |
124 | QPopupMenu *format = new QPopupMenu( this ); | 124 | QPopupMenu *format = new QPopupMenu( this ); |
125 | // QPopupMenu *edit = new QPopupMenu( this ); | 125 | // QPopupMenu *edit = new QPopupMenu( this ); |
126 | 126 | ||
127 | // bar = new QToolBar( this ); | 127 | // bar = new QToolBar( this ); |
128 | editBar = bar; | 128 | editBar = bar; |
129 | 129 | ||
130 | /* | 130 | /* |
131 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); | 131 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
132 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 132 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); |
133 | a->addTo( bar ); | 133 | a->addTo( bar ); |
134 | a->addTo( file ); | 134 | a->addTo( file ); |
135 | */ | 135 | */ |
136 | 136 | ||
@@ -399,281 +399,281 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
399 | a = new QAction( tr( "Save" ), QString::null, 0, this, NULL ); | 399 | a = new QAction( tr( "Save" ), QString::null, 0, this, NULL ); |
400 | connect( a, SIGNAL( activated() ), this, SLOT( savebkmks() ) ); | 400 | connect( a, SIGNAL( activated() ), this, SLOT( savebkmks() ) ); |
401 | a->addTo( marks ); | 401 | a->addTo( marks ); |
402 | 402 | ||
403 | a = new QAction( tr( "Tidy" ), QString::null, 0, this, NULL); | 403 | a = new QAction( tr( "Tidy" ), QString::null, 0, this, NULL); |
404 | connect( a, SIGNAL( activated() ), this, SLOT( listBkmkFiles() ) ); | 404 | connect( a, SIGNAL( activated() ), this, SLOT( listBkmkFiles() ) ); |
405 | marks->insertSeparator(); | 405 | marks->insertSeparator(); |
406 | a->addTo( marks ); | 406 | a->addTo( marks ); |
407 | 407 | ||
408 | mb->insertItem( tr( "File" ), file ); | 408 | mb->insertItem( tr( "File" ), file ); |
409 | // mb->insertItem( tr( "Edit" ), edit ); | 409 | // mb->insertItem( tr( "Edit" ), edit ); |
410 | mb->insertItem( tr( "Format" ), format ); | 410 | mb->insertItem( tr( "Format" ), format ); |
411 | mb->insertItem( tr( "Marks" ), marks ); | 411 | mb->insertItem( tr( "Marks" ), marks ); |
412 | 412 | ||
413 | searchBar = new QToolBar( "Search", this, QMainWindow::Top, TRUE ); | 413 | searchBar = new QToolBar( "Search", this, QMainWindow::Top, TRUE ); |
414 | 414 | ||
415 | searchBar->setHorizontalStretchable( TRUE ); | 415 | searchBar->setHorizontalStretchable( TRUE ); |
416 | 416 | ||
417 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 417 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
418 | // QFont f("unifont", 16 /*, QFont::Bold*/); | 418 | // QFont f("unifont", 16 /*, QFont::Bold*/); |
419 | // searchEdit->setFont( f ); | 419 | // searchEdit->setFont( f ); |
420 | searchBar->setStretchableWidget( searchEdit ); | 420 | searchBar->setStretchableWidget( searchEdit ); |
421 | #ifdef __ISEARCH | 421 | #ifdef __ISEARCH |
422 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 422 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), |
423 | this, SLOT( search( const QString& ) ) ); | 423 | this, SLOT( search( const QString& ) ) ); |
424 | #else | 424 | #else |
425 | connect( searchEdit, SIGNAL( returnPressed( ) ), | 425 | connect( searchEdit, SIGNAL( returnPressed( ) ), |
426 | this, SLOT( search( ) ) ); | 426 | this, SLOT( search( ) ) ); |
427 | #endif | 427 | #endif |
428 | a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); | 428 | a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); |
429 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); | 429 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); |
430 | a->addTo( searchBar ); | 430 | a->addTo( searchBar ); |
431 | 431 | ||
432 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 432 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
433 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 433 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
434 | a->addTo( searchBar ); | 434 | a->addTo( searchBar ); |
435 | 435 | ||
436 | searchBar->hide(); | 436 | searchBar->hide(); |
437 | 437 | ||
438 | regBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE ); | 438 | regBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE ); |
439 | 439 | ||
440 | regBar->setHorizontalStretchable( TRUE ); | 440 | regBar->setHorizontalStretchable( TRUE ); |
441 | 441 | ||
442 | regEdit = new QLineEdit( regBar, "regEdit" ); | 442 | regEdit = new QLineEdit( regBar, "regEdit" ); |
443 | // regEdit->setFont( f ); | 443 | // regEdit->setFont( f ); |
444 | 444 | ||
445 | regBar->setStretchableWidget( regEdit ); | 445 | regBar->setStretchableWidget( regEdit ); |
446 | 446 | ||
447 | connect( regEdit, SIGNAL( returnPressed( ) ), | 447 | connect( regEdit, SIGNAL( returnPressed( ) ), |
448 | this, SLOT( do_regaction() ) ); | 448 | this, SLOT( do_regaction() ) ); |
449 | 449 | ||
450 | a = new QAction( tr( "Do Reg" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); | 450 | a = new QAction( tr( "Do Reg" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); |
451 | connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) ); | 451 | connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) ); |
452 | a->addTo( regBar ); | 452 | a->addTo( regBar ); |
453 | 453 | ||
454 | a = new QAction( tr( "Close Edit" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 454 | a = new QAction( tr( "Close Edit" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
455 | connect( a, SIGNAL( activated() ), this, SLOT( regClose() ) ); | 455 | connect( a, SIGNAL( activated() ), this, SLOT( regClose() ) ); |
456 | a->addTo( regBar ); | 456 | a->addTo( regBar ); |
457 | 457 | ||
458 | regBar->hide(); | 458 | regBar->hide(); |
459 | 459 | ||
460 | m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE ); | 460 | m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE ); |
461 | 461 | ||
462 | m_fontBar->setHorizontalStretchable( TRUE ); | 462 | m_fontBar->setHorizontalStretchable( TRUE ); |
463 | 463 | ||
464 | m_fontSelector = new QComboBox(false, m_fontBar); | 464 | m_fontSelector = new QComboBox(false, m_fontBar); |
465 | m_fontBar->setStretchableWidget( m_fontSelector ); | 465 | m_fontBar->setStretchableWidget( m_fontSelector ); |
466 | { | 466 | { |
467 | FontDatabase f; | 467 | FontDatabase f; |
468 | m_fontSelector->insertStringList(f.families()); | 468 | m_fontSelector->insertStringList(f.families()); |
469 | } // delete the FontDatabase!!! | 469 | } // delete the FontDatabase!!! |
470 | connect( m_fontSelector, SIGNAL( activated(const QString& ) ), | 470 | connect( m_fontSelector, SIGNAL( activated(const QString& ) ), |
471 | this, SLOT( do_setfont(const QString&) ) ); | 471 | this, SLOT( do_setfont(const QString&) ) ); |
472 | 472 | ||
473 | m_fontBar->hide(); | 473 | m_fontBar->hide(); |
474 | m_fontVisible = false; | 474 | m_fontVisible = false; |
475 | 475 | ||
476 | connect(qApp, SIGNAL( appMessage(const QCString&, const QByteArray& ) ), | 476 | connect(qApp, SIGNAL( appMessage(const QCString&, const QByteArray& ) ), |
477 | this, SLOT( msgHandler(const QCString&, const QByteArray&) ) ); | 477 | this, SLOT( msgHandler(const QCString&, const QByteArray&) ) ); |
478 | 478 | ||
479 | 479 | ||
480 | if (!reader->m_lastfile.isEmpty()) | 480 | if (!reader->m_lastfile.isEmpty()) |
481 | { | 481 | { |
482 | openFile( reader->m_lastfile ); | 482 | openFile( reader->m_lastfile ); |
483 | doc = new DocLnk(reader->m_lastfile); | 483 | doc = new DocLnk(reader->m_lastfile); |
484 | } | 484 | } |
485 | m_EncodingAction[reader->m_encd]->setOn(true); | 485 | m_EncodingAction[reader->m_encd]->setOn(true); |
486 | do_setfont(reader->m_fontname); | 486 | do_setfont(reader->m_fontname); |
487 | } | 487 | } |
488 | 488 | ||
489 | void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data) | 489 | void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data) |
490 | { | 490 | { |
491 | QString msg = QString::fromUtf8(_msg); | 491 | QString msg = QString::fromUtf8(_msg); |
492 | 492 | ||
493 | // qDebug("Received:%s", (const char*)msg); | 493 | // qDebug("Received:%s", (const char*)msg); |
494 | 494 | ||
495 | QDataStream stream( _data, IO_ReadOnly ); | 495 | QDataStream stream( _data, IO_ReadOnly ); |
496 | if ( msg == "info(QString)" ) | 496 | if ( msg == "info(QString)" ) |
497 | { | 497 | { |
498 | QString info; | 498 | QString info; |
499 | stream >> info; | 499 | stream >> info; |
500 | QMessageBox::information(this, "QTReader", info); | 500 | QMessageBox::information(this, "QTReader", info); |
501 | } else if ( msg == "warn(QString)" ) | 501 | } else if ( msg == "warn(QString)" ) |
502 | { | 502 | { |
503 | QString info; | 503 | QString info; |
504 | stream >> info; | 504 | stream >> info; |
505 | QMessageBox::warning(this, "QTReader", info); | 505 | QMessageBox::warning(this, "QTReader", info); |
506 | } | 506 | } |
507 | } | 507 | } |
508 | 508 | ||
509 | int QTReaderApp::EncNameToInt(const QString& _enc) | 509 | int QTReaderApp::EncNameToInt(const QString& _enc) |
510 | { | 510 | { |
511 | for (int i = 0; i < MAX_ENCODING; i++) | 511 | for (int i = 0; i < MAX_ENCODING; i++) |
512 | { | 512 | { |
513 | if (m_EncodingAction[i]->text() == _enc) return i; | 513 | if (m_EncodingAction[i]->text() == _enc) return i; |
514 | } | 514 | } |
515 | return 0; | 515 | return 0; |
516 | /* | 516 | /* |
517 | if (_enc == "Ascii") return 0; | 517 | if (_enc == "Ascii") return 0; |
518 | if (_enc == "UTF-8") return 1; | 518 | if (_enc == "UTF-8") return 1; |
519 | if (_enc == "UCS-2(BE)") return 2; | 519 | if (_enc == "UCS-2(BE)") return 2; |
520 | if (_enc == "USC-2(LE)") return 3; | 520 | if (_enc == "USC-2(LE)") return 3; |
521 | */ | 521 | */ |
522 | } | 522 | } |
523 | 523 | ||
524 | void QTReaderApp::encodingSelected(QAction* _a) | 524 | void QTReaderApp::encodingSelected(QAction* _a) |
525 | { | 525 | { |
526 | // qDebug("es:%x : %s", _a, (const char *)(_a->text())); | 526 | // qDebug("es:%x : %s", _a, (const char *)(_a->text())); |
527 | reader->setencoding(EncNameToInt(_a->text())); | 527 | reader->setencoding(EncNameToInt(_a->text())); |
528 | } | 528 | } |
529 | 529 | ||
530 | QTReaderApp::~QTReaderApp() | 530 | QTReaderApp::~QTReaderApp() |
531 | { | 531 | { |
532 | } | 532 | } |
533 | 533 | ||
534 | void QTReaderApp::autoScroll(bool _b) | 534 | void QTReaderApp::autoScroll(bool _b) |
535 | { | 535 | { |
536 | reader->setautoscroll(_b); | 536 | reader->setautoscroll(_b); |
537 | } | 537 | } |
538 | 538 | ||
539 | void QTReaderApp::TBD() | 539 | void QTReaderApp::TBD() |
540 | { | 540 | { |
541 | QMessageBox::information(this, "QTReader", "Not yet implemented", 1); | 541 | QMessageBox::information(this, "QTReader", "Not yet implemented", 1); |
542 | } | 542 | } |
543 | 543 | ||
544 | void QTReaderApp::TBDzoom() | 544 | void QTReaderApp::TBDzoom() |
545 | { | 545 | { |
546 | QMessageBox::information(this, "QTReader", "Zooming is done interactively\nTry left/right cursor keys", 1); | 546 | QMessageBox::information(this, "QTReader", "Zooming is done interactively\nTry left/right cursor keys", 1); |
547 | } | 547 | } |
548 | 548 | ||
549 | void QTReaderApp::clearBkmkList() | 549 | void QTReaderApp::clearBkmkList() |
550 | { | 550 | { |
551 | delete pBkmklist; | 551 | delete pBkmklist; |
552 | pBkmklist = NULL; | 552 | pBkmklist = NULL; |
553 | m_fBkmksChanged = false; | 553 | m_fBkmksChanged = false; |
554 | } | 554 | } |
555 | 555 | ||
556 | void QTReaderApp::fileOpen() | 556 | void QTReaderApp::fileOpen() |
557 | { | 557 | { |
558 | /* | 558 | /* |
559 | menu->hide(); | 559 | menu->hide(); |
560 | editBar->hide(); | 560 | editBar->hide(); |
561 | if (regVisible) regBar->hide(); | 561 | if (regVisible) regBar->hide(); |
562 | if (searchVisible) searchBar->hide(); | 562 | if (searchVisible) searchBar->hide(); |
563 | */ | 563 | */ |
564 | if (pBkmklist != NULL) | 564 | if (pBkmklist != NULL) |
565 | { | 565 | { |
566 | if (m_fBkmksChanged) | 566 | if (m_fBkmksChanged) |
567 | { | 567 | { |
568 | if (QMessageBox::warning(this, "QTReader", "Save bookmarks?", "Save", "Don't bother") == 0) | 568 | if (QMessageBox::warning(this, "QTReader", "Save bookmarks?", "Save", "Don't bother") == 0) |
569 | savebkmks(); | 569 | savebkmks(); |
570 | } | 570 | } |
571 | delete pBkmklist; | 571 | delete pBkmklist; |
572 | pBkmklist = NULL; | 572 | pBkmklist = NULL; |
573 | m_fBkmksChanged = false; | 573 | m_fBkmksChanged = false; |
574 | } | 574 | } |
575 | reader->disableAutoscroll(); | 575 | reader->disableAutoscroll(); |
576 | /* | 576 | /* |
577 | editorStack->raiseWidget( fileSelector ); | 577 | editorStack->raiseWidget( fileSelector ); |
578 | fileSelector->reread(); | 578 | fileSelector->reread(); |
579 | */ | 579 | */ |
580 | fileBrowser* fb = new fileBrowser(this,"QTReader",TRUE, | 580 | fileBrowser* fb = new fileBrowser(this,"QTReader",TRUE, |
581 | 0, | 581 | 0, |
582 | // WStyle_Customize | WStyle_NoBorderEx, | 582 | // WStyle_Customize | WStyle_NoBorderEx, |
583 | "*", QFileInfo(reader->m_lastfile).dirPath(true)); | 583 | "*", QFileInfo(reader->m_lastfile).dirPath(true)); |
584 | 584 | ||
585 | if (fb->exec()) | 585 | if (fb->exec()) |
586 | { | 586 | { |
587 | QString fn(fb->fileList[0]); | 587 | QString fn(fb->fileList[0]); |
588 | // fb->populateList(); | 588 | // fb->populateList(); |
589 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn); | 589 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn); |
590 | } | 590 | } |
591 | delete fb; | 591 | delete fb; |
592 | } | 592 | } |
593 | 593 | ||
594 | void QTReaderApp::showinfo() | 594 | void QTReaderApp::showinfo() |
595 | { | 595 | { |
596 | unsigned long fs, ts, pl; | 596 | unsigned long fs, ts, pl; |
597 | if (reader->empty()) | 597 | if (reader->empty()) |
598 | { | 598 | { |
599 | QMessageBox::information(this, "QTReader", "No file loaded", 1); | 599 | QMessageBox::information(this, "QTReader", "No file loaded", 1); |
600 | } | 600 | } |
601 | else | 601 | else |
602 | { | 602 | { |
603 | reader->sizes(fs,ts); | 603 | reader->sizes(fs,ts); |
604 | pl = reader->pagelocate(); | 604 | pl = reader->pagelocate(); |
605 | m_infoWin->setFileSize(fs); | 605 | m_infoWin->setFileSize(fs); |
606 | m_infoWin->setTextSize(ts); | 606 | m_infoWin->setTextSize(ts); |
607 | m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); | 607 | m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); |
608 | m_infoWin->setLocation(pl); | 608 | m_infoWin->setLocation(pl); |
609 | m_infoWin->setRead((100*pl + (ts >> 1))/ts); | 609 | m_infoWin->setRead((100*pl + (ts >> 1))/ts); |
610 | editorStack->raiseWidget( m_infoWin ); | 610 | editorStack->raiseWidget( m_infoWin ); |
611 | m_infoWin->setFocus(); | 611 | m_infoWin->setFocus(); |
612 | } | 612 | } |
613 | } | 613 | } |
614 | 614 | ||
615 | void QTReaderApp::infoClose() | 615 | void QTReaderApp::infoClose() |
616 | { | 616 | { |
617 | showEditTools(); | 617 | showEditTools(); |
618 | } | 618 | } |
619 | 619 | ||
620 | /* | 620 | /* |
621 | void QTReaderApp::fileRevert() | 621 | void QTReaderApp::fileRevert() |
622 | { | 622 | { |
623 | clear(); | 623 | clear(); |
624 | fileOpen(); | 624 | fileOpen(); |
625 | } | 625 | } |
626 | 626 | ||
627 | void QTReaderApp::editCut() | 627 | void QTReaderApp::editCut() |
628 | { | 628 | { |
629 | #ifndef QT_NO_CLIPBOARD | 629 | #ifndef QT_NO_CLIPBOARD |
630 | editor->cut(); | 630 | editor->cut(); |
631 | #endif | 631 | #endif |
632 | } | 632 | } |
633 | */ | 633 | */ |
634 | void QTReaderApp::editMark() | 634 | void QTReaderApp::editMark() |
635 | { | 635 | { |
636 | m_savedpos = reader->pagelocate(); | 636 | m_savedpos = reader->pagelocate(); |
637 | } | 637 | } |
638 | 638 | ||
639 | void QTReaderApp::editCopy() | 639 | void QTReaderApp::editCopy() |
640 | { | 640 | { |
641 | QClipboard* cb = QApplication::clipboard(); | 641 | QClipboard* cb = QApplication::clipboard(); |
642 | QString text; | 642 | QString text; |
643 | int ch; | 643 | int ch; |
644 | unsigned long currentpos = reader->pagelocate(); | 644 | unsigned long currentpos = reader->pagelocate(); |
645 | unsigned long endpos = reader->locate(); | 645 | unsigned long endpos = reader->locate(); |
646 | reader->jumpto(m_savedpos); | 646 | reader->jumpto(m_savedpos); |
647 | while (reader->locate() < endpos && (ch = reader->getch()) != UEOF) | 647 | while (reader->locate() < endpos && (ch = reader->getch()) != UEOF) |
648 | { | 648 | { |
649 | text += ch; | 649 | text += ch; |
650 | } | 650 | } |
651 | cb->setText(text); | 651 | cb->setText(text); |
652 | //text = cb->text(); | 652 | // text = cb->text(); |
653 | //if (text) | 653 | // if (text) |
654 | // qDebug("The clipboard contains: %s", (const tchar*)text); | 654 | // qDebug("The clipboard contains: %s", (const tchar*)text); |
655 | reader->locate(currentpos); | 655 | reader->locate(currentpos); |
656 | #ifndef QT_NO_CLIPBOARD | 656 | #ifndef QT_NO_CLIPBOARD |
657 | // TBD(); | 657 | // TBD(); |
658 | // reader->copy(); | 658 | // reader->copy(); |
659 | #endif | 659 | #endif |
660 | } | 660 | } |
661 | 661 | ||
662 | void QTReaderApp::pageup() | 662 | void QTReaderApp::pageup() |
663 | { | 663 | { |
664 | reader->goUp(); | 664 | reader->goUp(); |
665 | } | 665 | } |
666 | 666 | ||
667 | void QTReaderApp::pagedn() | 667 | void QTReaderApp::pagedn() |
668 | { | 668 | { |
669 | reader->goDown(); | 669 | reader->goDown(); |
670 | } | 670 | } |
671 | 671 | ||
672 | void QTReaderApp::stripcr(bool _b) | 672 | void QTReaderApp::stripcr(bool _b) |
673 | { | 673 | { |
674 | reader->setstripcr(_b); | 674 | reader->setstripcr(_b); |
675 | } | 675 | } |
676 | void QTReaderApp::striphtml(bool _b) | 676 | void QTReaderApp::striphtml(bool _b) |
677 | { | 677 | { |
678 | reader->setstriphtml(_b); | 678 | reader->setstriphtml(_b); |
679 | } | 679 | } |
@@ -710,77 +710,77 @@ void QTReaderApp::monospace(bool _b) | |||
710 | } | 710 | } |
711 | 711 | ||
712 | void QTReaderApp::setspacing() | 712 | void QTReaderApp::setspacing() |
713 | { | 713 | { |
714 | m_nRegAction = cMonoSpace; | 714 | m_nRegAction = cMonoSpace; |
715 | char lcn[20]; | 715 | char lcn[20]; |
716 | sprintf(lcn, "%lu", reader->m_charpc); | 716 | sprintf(lcn, "%lu", reader->m_charpc); |
717 | regEdit->setText(lcn); | 717 | regEdit->setText(lcn); |
718 | do_regedit(); | 718 | do_regedit(); |
719 | } | 719 | } |
720 | 720 | ||
721 | void QTReaderApp::setoverlap() | 721 | void QTReaderApp::setoverlap() |
722 | { | 722 | { |
723 | m_nRegAction = cOverlap; | 723 | m_nRegAction = cOverlap; |
724 | char lcn[20]; | 724 | char lcn[20]; |
725 | sprintf(lcn, "%lu", reader->m_overlap); | 725 | sprintf(lcn, "%lu", reader->m_overlap); |
726 | regEdit->setText(lcn); | 726 | regEdit->setText(lcn); |
727 | do_regedit(); | 727 | do_regedit(); |
728 | } | 728 | } |
729 | 729 | ||
730 | void QTReaderApp::settarget() | 730 | void QTReaderApp::settarget() |
731 | { | 731 | { |
732 | m_nRegAction = cSetTarget; | 732 | m_nRegAction = cSetTarget; |
733 | QString text = ((reader->m_targetapp.isEmpty()) ? QString("") : reader->m_targetapp) | 733 | QString text = ((reader->m_targetapp.isEmpty()) ? QString("") : reader->m_targetapp) |
734 | + "/" | 734 | + "/" |
735 | + ((reader->m_targetmsg.isEmpty()) ? QString("") : reader->m_targetmsg); | 735 | + ((reader->m_targetmsg.isEmpty()) ? QString("") : reader->m_targetmsg); |
736 | regEdit->setText(text); | 736 | regEdit->setText(text); |
737 | do_regedit(); | 737 | do_regedit(); |
738 | } | 738 | } |
739 | 739 | ||
740 | void QTReaderApp::do_overlap(const QString& lcn) | 740 | void QTReaderApp::do_overlap(const QString& lcn) |
741 | { | 741 | { |
742 | bool ok; | 742 | bool ok; |
743 | unsigned long ulcn = lcn.toULong(&ok); | 743 | unsigned long ulcn = lcn.toULong(&ok); |
744 | if (ok) | 744 | if (ok) |
745 | { | 745 | { |
746 | reader->m_overlap = ulcn; | 746 | reader->m_overlap = ulcn; |
747 | } | 747 | } |
748 | else | 748 | else |
749 | QMessageBox::information(this, "QTReader", "Must be a number"); | 749 | QMessageBox::information(this, "QTReader", "Must be a number"); |
750 | } | 750 | } |
751 | 751 | ||
752 | void QTReaderApp::do_mono(const QString& lcn) | 752 | void QTReaderApp::do_mono(const QString& lcn) |
753 | { | 753 | { |
754 | bool ok; | 754 | bool ok; |
755 | unsigned long ulcn = lcn.toULong(&ok); | 755 | unsigned long ulcn = lcn.toULong(&ok); |
756 | if (ok) | 756 | if (ok) |
757 | { | 757 | { |
758 | reader->m_charpc = ulcn; | 758 | reader->m_charpc = ulcn; |
759 | //reader->setmono(true); | 759 | // reader->setmono(true); |
760 | } | 760 | } |
761 | else | 761 | else |
762 | QMessageBox::information(this, "QTReader", "Must be a number"); | 762 | QMessageBox::information(this, "QTReader", "Must be a number"); |
763 | } | 763 | } |
764 | 764 | ||
765 | /* | 765 | /* |
766 | void QTReaderApp::editPaste() | 766 | void QTReaderApp::editPaste() |
767 | { | 767 | { |
768 | #ifndef QT_NO_CLIPBOARD | 768 | #ifndef QT_NO_CLIPBOARD |
769 | editor->paste(); | 769 | editor->paste(); |
770 | #endif | 770 | #endif |
771 | } | 771 | } |
772 | */ | 772 | */ |
773 | 773 | ||
774 | void QTReaderApp::editFind() | 774 | void QTReaderApp::editFind() |
775 | { | 775 | { |
776 | searchStart = reader->pagelocate(); | 776 | searchStart = reader->pagelocate(); |
777 | #ifdef __ISEARCH | 777 | #ifdef __ISEARCH |
778 | searchStack = new QStack<searchrecord>; | 778 | searchStack = new QStack<searchrecord>; |
779 | #endif | 779 | #endif |
780 | searchBar->show(); | 780 | searchBar->show(); |
781 | searchVisible = TRUE; | 781 | searchVisible = TRUE; |
782 | searchEdit->setFocus(); | 782 | searchEdit->setFocus(); |
783 | #ifdef __ISEARCH | 783 | #ifdef __ISEARCH |
784 | searchStack->push(new searchrecord("",reader->pagelocate())); | 784 | searchStack->push(new searchrecord("",reader->pagelocate())); |
785 | #endif | 785 | #endif |
786 | } | 786 | } |
@@ -824,57 +824,57 @@ void QTReaderApp::regClose() | |||
824 | reader->setFocus(); | 824 | reader->setFocus(); |
825 | } | 825 | } |
826 | 826 | ||
827 | #ifdef __ISEARCH | 827 | #ifdef __ISEARCH |
828 | bool QTReaderApp::dosearch(size_t start, CBuffer& test, const QString& arg) | 828 | bool QTReaderApp::dosearch(size_t start, CBuffer& test, const QString& arg) |
829 | #else | 829 | #else |
830 | bool QTReaderApp::dosearch(size_t start, CBuffer& test, const QRegExp& arg) | 830 | bool QTReaderApp::dosearch(size_t start, CBuffer& test, const QRegExp& arg) |
831 | #endif | 831 | #endif |
832 | { | 832 | { |
833 | bool ret = true; | 833 | bool ret = true; |
834 | size_t pos = start; | 834 | size_t pos = start; |
835 | reader->buffdoc.getline(&test,reader->width()); | 835 | reader->buffdoc.getline(&test,reader->width()); |
836 | #ifdef __ISEARCH | 836 | #ifdef __ISEARCH |
837 | while (strstr(test.data(),(const tchar*)arg) == NULL) | 837 | while (strstr(test.data(),(const tchar*)arg) == NULL) |
838 | #else | 838 | #else |
839 | #ifdef _UNICODE | 839 | #ifdef _UNICODE |
840 | while (arg.match(toQString(test.data())) == -1) | 840 | while (arg.match(toQString(test.data())) == -1) |
841 | #else | 841 | #else |
842 | while (arg.match(test.data()) == -1) | 842 | while (arg.match(test.data()) == -1) |
843 | #endif | 843 | #endif |
844 | #endif | 844 | #endif |
845 | { | 845 | { |
846 | pos = reader->locate(); | 846 | pos = reader->locate(); |
847 | if (!reader->buffdoc.getline(&test,reader->width())) | 847 | if (!reader->buffdoc.getline(&test,reader->width())) |
848 | { | 848 | { |
849 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) | 849 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) |
850 | pos = searchStart; | 850 | pos = searchStart; |
851 | else | 851 | else |
852 | pos = start; | 852 | pos = start; |
853 | ret = false; | 853 | ret = false; |
854 | findClose(); | 854 | findClose(); |
855 | break; | 855 | break; |
856 | } | 856 | } |
857 | } | 857 | } |
858 | reader->locate(pos); | 858 | reader->locate(pos); |
859 | return ret; | 859 | return ret; |
860 | } | 860 | } |
861 | 861 | ||
862 | #ifdef __ISEARCH | 862 | #ifdef __ISEARCH |
863 | void QTReaderApp::search(const QString & arg) | 863 | void QTReaderApp::search(const QString & arg) |
864 | { | 864 | { |
865 | searchrecord* ss = searchStack->top(); | 865 | searchrecord* ss = searchStack->top(); |
866 | CBuffer test; | 866 | CBuffer test; |
867 | size_t start = reader->pagelocate(); | 867 | size_t start = reader->pagelocate(); |
868 | bool haspopped = false; | 868 | bool haspopped = false; |
869 | while (arg.left(ss->s.length()) != ss->s) | 869 | while (arg.left(ss->s.length()) != ss->s) |
870 | { | 870 | { |
871 | haspopped = true; | 871 | haspopped = true; |
872 | start = ss->pos; | 872 | start = ss->pos; |
873 | // reader->locate(start); | 873 | // reader->locate(start); |
874 | searchStack->pop(); | 874 | searchStack->pop(); |
875 | delete ss; | 875 | delete ss; |
876 | } | 876 | } |
877 | if (haspopped) reader->locate(start); | 877 | if (haspopped) reader->locate(start); |
878 | /* | 878 | /* |
879 | if (arg.length() < ss->len) | 879 | if (arg.length() < ss->len) |
880 | { | 880 | { |
@@ -916,382 +916,382 @@ void QTReaderApp::openFile( const DocLnk &f ) | |||
916 | { | 916 | { |
917 | // QMessageBox::information(0, "Progress", "Calling fileNew()"); | 917 | // QMessageBox::information(0, "Progress", "Calling fileNew()"); |
918 | 918 | ||
919 | clear(); | 919 | clear(); |
920 | 920 | ||
921 | // editorStack->raiseWidget( reader ); | 921 | // editorStack->raiseWidget( reader ); |
922 | 922 | ||
923 | // reader->setFocus(); | 923 | // reader->setFocus(); |
924 | 924 | ||
925 | // QMessageBox::information(0, "DocLnk", "Begin"); | 925 | // QMessageBox::information(0, "DocLnk", "Begin"); |
926 | doc = new DocLnk(f); | 926 | doc = new DocLnk(f); |
927 | // QMessageBox::information(0, "DocLnk done", doc->file()); | 927 | // QMessageBox::information(0, "DocLnk done", doc->file()); |
928 | // QMessageBox::information(0, "Progress", "Calling setText()"); | 928 | // QMessageBox::information(0, "Progress", "Calling setText()"); |
929 | // QMessageBox::information(0, "Progress", "Textset"); | 929 | // QMessageBox::information(0, "Progress", "Textset"); |
930 | 930 | ||
931 | // updateCaption(); | 931 | // updateCaption(); |
932 | showEditTools(); | 932 | showEditTools(); |
933 | reader->setText(doc->name(), doc->file()); | 933 | reader->setText(doc->name(), doc->file()); |
934 | readbkmks(); | 934 | readbkmks(); |
935 | } | 935 | } |
936 | else | 936 | else |
937 | { | 937 | { |
938 | QMessageBox::information(this, "QTReader", "File does not exist"); | 938 | QMessageBox::information(this, "QTReader", "File does not exist"); |
939 | } | 939 | } |
940 | 940 | ||
941 | } | 941 | } |
942 | 942 | ||
943 | void QTReaderApp::showEditTools() | 943 | void QTReaderApp::showEditTools() |
944 | { | 944 | { |
945 | if ( !doc ) | 945 | if ( !doc ) |
946 | close(); | 946 | close(); |
947 | // fileSelector->hide(); | 947 | // fileSelector->hide(); |
948 | menu->show(); | 948 | menu->show(); |
949 | editBar->show(); | 949 | editBar->show(); |
950 | if ( searchVisible ) | 950 | if ( searchVisible ) |
951 | searchBar->show(); | 951 | searchBar->show(); |
952 | if ( regVisible ) | 952 | if ( regVisible ) |
953 | regBar->show(); | 953 | regBar->show(); |
954 | if (m_fontVisible) m_fontBar->show(); | 954 | if (m_fontVisible) m_fontBar->show(); |
955 | 955 | ||
956 | updateCaption(); | 956 | updateCaption(); |
957 | editorStack->raiseWidget( reader ); | 957 | editorStack->raiseWidget( reader ); |
958 | reader->setFocus(); | 958 | reader->setFocus(); |
959 | } | 959 | } |
960 | /* | 960 | /* |
961 | void QTReaderApp::save() | 961 | void QTReaderApp::save() |
962 | { | 962 | { |
963 | if ( !doc ) | 963 | if ( !doc ) |
964 | return; | 964 | return; |
965 | if ( !editor->edited() ) | 965 | if ( !editor->edited() ) |
966 | return; | 966 | return; |
967 | 967 | ||
968 | QString rt = editor->text(); | 968 | QString rt = editor->text(); |
969 | QString pt = rt; | 969 | QString pt = rt; |
970 | 970 | ||
971 | if ( doc->name().isEmpty() ) { | 971 | if ( doc->name().isEmpty() ) { |
972 | unsigned ispace = pt.find( ' ' ); | 972 | unsigned ispace = pt.find( ' ' ); |
973 | unsigned ienter = pt.find( '\n' ); | 973 | unsigned ienter = pt.find( '\n' ); |
974 | int i = (ispace < ienter) ? ispace : ienter; | 974 | int i = (ispace < ienter) ? ispace : ienter; |
975 | QString docname; | 975 | QString docname; |
976 | if ( i == -1 ) { | 976 | if ( i == -1 ) { |
977 | if ( pt.isEmpty() ) | 977 | if ( pt.isEmpty() ) |
978 | docname = "Empty Text"; | 978 | docname = "Empty Text"; |
979 | else | 979 | else |
980 | docname = pt; | 980 | docname = pt; |
981 | } else { | 981 | } else { |
982 | docname = pt.left( i ); | 982 | docname = pt.left( i ); |
983 | } | 983 | } |
984 | doc->setName(docname); | 984 | doc->setName(docname); |
985 | } | 985 | } |
986 | FileManager fm; | 986 | FileManager fm; |
987 | fm.saveFile( *doc, rt ); | 987 | fm.saveFile( *doc, rt ); |
988 | } | 988 | } |
989 | */ | 989 | */ |
990 | 990 | ||
991 | void QTReaderApp::clear() | 991 | void QTReaderApp::clear() |
992 | { | 992 | { |
993 | if (doc != 0) | 993 | if (doc != 0) |
994 | { | 994 | { |
995 | // QMessageBox::information(this, "QTReader", "Deleting doc", 1); | 995 | // QMessageBox::information(this, "QTReader", "Deleting doc", 1); |
996 | delete doc; | 996 | delete doc; |
997 | // QMessageBox::information(this, "QTReader", "Deleted doc", 1); | 997 | // QMessageBox::information(this, "QTReader", "Deleted doc", 1); |
998 | doc = 0; | 998 | doc = 0; |
999 | } | 999 | } |
1000 | reader->clear(); | 1000 | reader->clear(); |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | void QTReaderApp::updateCaption() | 1003 | void QTReaderApp::updateCaption() |
1004 | { | 1004 | { |
1005 | if ( !doc ) | 1005 | if ( !doc ) |
1006 | setCaption( tr("QTReader") ); | 1006 | setCaption( tr("Opie Reader") ); |
1007 | else { | 1007 | else { |
1008 | QString s = doc->name(); | 1008 | QString s = doc->name(); |
1009 | if ( s.isEmpty() ) | 1009 | if ( s.isEmpty() ) |
1010 | s = tr( "Unnamed" ); | 1010 | s = tr( "Unnamed" ); |
1011 | setCaption( s + " - " + tr("QTReader") ); | 1011 | setCaption( s + " - " + tr("Opie Reader") ); |
1012 | } | 1012 | } |
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | void QTReaderApp::setDocument(const QString& fileref) | 1015 | void QTReaderApp::setDocument(const QString& fileref) |
1016 | { | 1016 | { |
1017 | bFromDocView = TRUE; | 1017 | bFromDocView = TRUE; |
1018 | //QMessageBox::information(0, "setDocument", fileref); | 1018 | //QMessageBox::information(0, "setDocument", fileref); |
1019 | openFile(DocLnk(fileref)); | 1019 | openFile(DocLnk(fileref)); |
1020 | // showEditTools(); | 1020 | // showEditTools(); |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | void QTReaderApp::closeEvent( QCloseEvent *e ) | 1023 | void QTReaderApp::closeEvent( QCloseEvent *e ) |
1024 | { | 1024 | { |
1025 | if (editorStack->visibleWidget() == reader) | 1025 | if (editorStack->visibleWidget() == reader) |
1026 | { | 1026 | { |
1027 | if (m_fontVisible) | 1027 | if (m_fontVisible) |
1028 | { | 1028 | { |
1029 | m_fontBar->hide(); | 1029 | m_fontBar->hide(); |
1030 | m_fontVisible = false; | 1030 | m_fontVisible = false; |
1031 | } | 1031 | } |
1032 | if (regVisible) | 1032 | if (regVisible) |
1033 | { | 1033 | { |
1034 | regBar->hide(); | 1034 | regBar->hide(); |
1035 | regVisible = false; | 1035 | regVisible = false; |
1036 | return; | 1036 | return; |
1037 | } | 1037 | } |
1038 | if (searchVisible) | 1038 | if (searchVisible) |
1039 | { | 1039 | { |
1040 | searchBar->hide(); | 1040 | searchBar->hide(); |
1041 | searchVisible = false; | 1041 | searchVisible = false; |
1042 | return; | 1042 | return; |
1043 | } | 1043 | } |
1044 | if (m_fBkmksChanged && pBkmklist != NULL) | 1044 | if (m_fBkmksChanged && pBkmklist != NULL) |
1045 | { | 1045 | { |
1046 | if (QMessageBox::warning(this, "QTReader", "Save bookmarks?", "Save", "Don't bother") == 0) | 1046 | if (QMessageBox::warning(this, "QTReader", "Save bookmarks?", "Save", "Don't bother") == 0) |
1047 | savebkmks(); | 1047 | savebkmks(); |
1048 | delete pBkmklist; | 1048 | delete pBkmklist; |
1049 | pBkmklist = NULL; | 1049 | pBkmklist = NULL; |
1050 | m_fBkmksChanged = false; | 1050 | m_fBkmksChanged = false; |
1051 | } | 1051 | } |
1052 | bFromDocView = FALSE; | 1052 | bFromDocView = FALSE; |
1053 | saveprefs(); | 1053 | saveprefs(); |
1054 | e->accept(); | 1054 | e->accept(); |
1055 | } | 1055 | } |
1056 | else | 1056 | else |
1057 | { | 1057 | { |
1058 | showEditTools(); | 1058 | showEditTools(); |
1059 | } | 1059 | } |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | void QTReaderApp::do_gotomark() | 1062 | void QTReaderApp::do_gotomark() |
1063 | { | 1063 | { |
1064 | m_nRegAction = cGotoBkmk; | 1064 | m_nRegAction = cGotoBkmk; |
1065 | listbkmk(); | 1065 | listbkmk(); |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | void QTReaderApp::do_delmark() | 1068 | void QTReaderApp::do_delmark() |
1069 | { | 1069 | { |
1070 | m_nRegAction = cDelBkmk; | 1070 | m_nRegAction = cDelBkmk; |
1071 | listbkmk(); | 1071 | listbkmk(); |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | void QTReaderApp::listbkmk() | 1074 | void QTReaderApp::listbkmk() |
1075 | { | 1075 | { |
1076 | bkmkselector->clear(); | 1076 | bkmkselector->clear(); |
1077 | int cnt = 0; | 1077 | int cnt = 0; |
1078 | if (pBkmklist != NULL) | 1078 | if (pBkmklist != NULL) |
1079 | { | 1079 | { |
1080 | if (m_fBkmksChanged) pBkmklist->sort(); | 1080 | if (m_fBkmksChanged) pBkmklist->sort(); |
1081 | for (CList<Bkmk>::iterator i = pBkmklist->begin(); i != pBkmklist->end(); i++) | 1081 | for (CList<Bkmk>::iterator i = pBkmklist->begin(); i != pBkmklist->end(); i++) |
1082 | { | 1082 | { |
1083 | #ifdef _UNICODE | 1083 | #ifdef _UNICODE |
1084 | bkmkselector->insertItem(toQString(i->name())); | 1084 | bkmkselector->insertItem(toQString(i->name())); |
1085 | #else | 1085 | #else |
1086 | bkmkselector->insertItem(i->name()); | 1086 | bkmkselector->insertItem(i->name()); |
1087 | #endif | 1087 | #endif |
1088 | cnt++; | 1088 | cnt++; |
1089 | } | 1089 | } |
1090 | } | 1090 | } |
1091 | if (cnt > 0) | 1091 | if (cnt > 0) |
1092 | { | 1092 | { |
1093 | menu->hide(); | 1093 | menu->hide(); |
1094 | editBar->hide(); | 1094 | editBar->hide(); |
1095 | if (m_fontVisible) m_fontBar->hide(); | 1095 | if (m_fontVisible) m_fontBar->hide(); |
1096 | if (regVisible) regBar->hide(); | 1096 | if (regVisible) regBar->hide(); |
1097 | if (searchVisible) searchBar->hide(); | 1097 | if (searchVisible) searchBar->hide(); |
1098 | editorStack->raiseWidget( bkmkselector ); | 1098 | editorStack->raiseWidget( bkmkselector ); |
1099 | } | 1099 | } |
1100 | else | 1100 | else |
1101 | QMessageBox::information(this, "QTReader", "No bookmarks in memory"); | 1101 | QMessageBox::information(this, "QTReader", "No bookmarks in memory"); |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | void QTReaderApp::do_autogen() | 1104 | void QTReaderApp::do_autogen() |
1105 | { | 1105 | { |
1106 | m_nRegAction = cAutoGen; | 1106 | m_nRegAction = cAutoGen; |
1107 | regEdit->setText(m_autogenstr); | 1107 | regEdit->setText(m_autogenstr); |
1108 | do_regedit(); | 1108 | do_regedit(); |
1109 | } | 1109 | } |
1110 | 1110 | ||
1111 | void QTReaderApp::do_regedit() | 1111 | void QTReaderApp::do_regedit() |
1112 | { | 1112 | { |
1113 | // editBar->hide(); | 1113 | // editBar->hide(); |
1114 | regBar->show(); | 1114 | regBar->show(); |
1115 | regVisible = true; | 1115 | regVisible = true; |
1116 | regEdit->setFocus(); | 1116 | regEdit->setFocus(); |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | void QTReaderApp::gotobkmk(int ind) | 1119 | void QTReaderApp::gotobkmk(int ind) |
1120 | { | 1120 | { |
1121 | switch (m_nRegAction) | 1121 | switch (m_nRegAction) |
1122 | { | 1122 | { |
1123 | case cGotoBkmk: | 1123 | case cGotoBkmk: |
1124 | reader->locate((*pBkmklist)[ind]->value()); | 1124 | reader->locate((*pBkmklist)[ind]->value()); |
1125 | break; | 1125 | break; |
1126 | case cDelBkmk: | 1126 | case cDelBkmk: |
1127 | // qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name()); | 1127 | // qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name()); |
1128 | pBkmklist->erase(ind); | 1128 | pBkmklist->erase(ind); |
1129 | m_fBkmksChanged = true; | 1129 | m_fBkmksChanged = true; |
1130 | break; | 1130 | break; |
1131 | case cRmBkmkFile: | 1131 | case cRmBkmkFile: |
1132 | unlink((const char *)Global::applicationFileName("uqtreader",bkmkselector->text(ind))); | 1132 | unlink((const char *)Global::applicationFileName("uqtreader",bkmkselector->text(ind))); |
1133 | break; | 1133 | break; |
1134 | } | 1134 | } |
1135 | showEditTools(); | 1135 | showEditTools(); |
1136 | } | 1136 | } |
1137 | 1137 | ||
1138 | void QTReaderApp::cancelbkmk() | 1138 | void QTReaderApp::cancelbkmk() |
1139 | { | 1139 | { |
1140 | showEditTools(); | 1140 | showEditTools(); |
1141 | } | 1141 | } |
1142 | 1142 | ||
1143 | void QTReaderApp::jump() | 1143 | void QTReaderApp::jump() |
1144 | { | 1144 | { |
1145 | m_nRegAction = cJump; | 1145 | m_nRegAction = cJump; |
1146 | char lcn[20]; | 1146 | char lcn[20]; |
1147 | sprintf(lcn, "%lu", reader->pagelocate()); | 1147 | sprintf(lcn, "%lu", reader->pagelocate()); |
1148 | regEdit->setText(lcn); | 1148 | regEdit->setText(lcn); |
1149 | do_regedit(); | 1149 | do_regedit(); |
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | void QTReaderApp::do_jump(const QString& lcn) | 1152 | void QTReaderApp::do_jump(const QString& lcn) |
1153 | { | 1153 | { |
1154 | bool ok; | 1154 | bool ok; |
1155 | unsigned long ulcn = lcn.toULong(&ok); | 1155 | unsigned long ulcn = lcn.toULong(&ok); |
1156 | if (ok) | 1156 | if (ok) |
1157 | reader->locate(ulcn); | 1157 | reader->locate(ulcn); |
1158 | else | 1158 | else |
1159 | QMessageBox::information(this, "QTReader", "Must be a number"); | 1159 | QMessageBox::information(this, "QTReader", "Must be a number"); |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | void QTReaderApp::do_regaction() | 1162 | void QTReaderApp::do_regaction() |
1163 | { | 1163 | { |
1164 | regBar->hide(); | 1164 | regBar->hide(); |
1165 | regVisible = false; | 1165 | regVisible = false; |
1166 | switch(m_nRegAction) | 1166 | switch(m_nRegAction) |
1167 | { | 1167 | { |
1168 | case cAutoGen: | 1168 | case cAutoGen: |
1169 | do_autogen(regEdit->text()); | 1169 | do_autogen(regEdit->text()); |
1170 | break; | 1170 | break; |
1171 | case cAddBkmk: | 1171 | case cAddBkmk: |
1172 | do_addbkmk(regEdit->text()); | 1172 | do_addbkmk(regEdit->text()); |
1173 | break; | 1173 | break; |
1174 | case cJump: | 1174 | case cJump: |
1175 | do_jump(regEdit->text()); | 1175 | do_jump(regEdit->text()); |
1176 | break; | 1176 | break; |
1177 | case cMonoSpace: | 1177 | case cMonoSpace: |
1178 | do_mono(regEdit->text()); | 1178 | do_mono(regEdit->text()); |
1179 | break; | 1179 | break; |
1180 | case cOverlap: | 1180 | case cOverlap: |
1181 | do_overlap(regEdit->text()); | 1181 | do_overlap(regEdit->text()); |
1182 | break; | 1182 | break; |
1183 | case cSetTarget: | 1183 | case cSetTarget: |
1184 | do_settarget(regEdit->text()); | 1184 | do_settarget(regEdit->text()); |
1185 | break; | 1185 | break; |
1186 | } | 1186 | } |
1187 | reader->restore(); | 1187 | reader->restore(); |
1188 | // editBar->show(); | 1188 | // editBar->show(); |
1189 | reader->setFocus(); | 1189 | reader->setFocus(); |
1190 | } | 1190 | } |
1191 | 1191 | ||
1192 | void QTReaderApp::do_settarget(const QString& _txt) | 1192 | void QTReaderApp::do_settarget(const QString& _txt) |
1193 | { | 1193 | { |
1194 | int ind = _txt.find('/'); | 1194 | int ind = _txt.find('/'); |
1195 | if (ind == -1) | 1195 | if (ind == -1) |
1196 | { | 1196 | { |
1197 | reader->m_targetapp = ""; | 1197 | reader->m_targetapp = ""; |
1198 | reader->m_targetmsg = ""; | 1198 | reader->m_targetmsg = ""; |
1199 | QMessageBox::information(this, "QTReader", "Format is\nappname/messagename"); | 1199 | QMessageBox::information(this, "QTReader", "Format is\nappname/messagename"); |
1200 | } | 1200 | } |
1201 | else | 1201 | else |
1202 | { | 1202 | { |
1203 | reader->m_targetapp = _txt.left(ind); | 1203 | reader->m_targetapp = _txt.left(ind); |
1204 | reader->m_targetmsg = _txt.right(_txt.length()-ind-1); | 1204 | reader->m_targetmsg = _txt.right(_txt.length()-ind-1); |
1205 | } | 1205 | } |
1206 | } | 1206 | } |
1207 | 1207 | ||
1208 | void QTReaderApp::setfont() | 1208 | void QTReaderApp::setfont() |
1209 | { | 1209 | { |
1210 | for (int i = 1; i <= m_fontSelector->count(); i++) | 1210 | for (int i = 1; i <= m_fontSelector->count(); i++) |
1211 | { | 1211 | { |
1212 | if (m_fontSelector->text(i) == reader->m_fontname) | 1212 | if (m_fontSelector->text(i) == reader->m_fontname) |
1213 | { | 1213 | { |
1214 | m_fontSelector->setCurrentItem(i); | 1214 | m_fontSelector->setCurrentItem(i); |
1215 | break; | 1215 | break; |
1216 | } | 1216 | } |
1217 | } | 1217 | } |
1218 | m_fontBar->show(); | 1218 | m_fontBar->show(); |
1219 | m_fontVisible = true; | 1219 | m_fontVisible = true; |
1220 | } | 1220 | } |
1221 | 1221 | ||
1222 | void QTReaderApp::do_setfont(const QString& lcn) | 1222 | void QTReaderApp::do_setfont(const QString& lcn) |
1223 | { | 1223 | { |
1224 | QFont f(lcn, 10 /*, QFont::Bold*/); | 1224 | QFont f(lcn, 10 /*, QFont::Bold*/); |
1225 | bkmkselector->setFont( f ); | 1225 | bkmkselector->setFont( f ); |
1226 | regEdit->setFont( f ); | 1226 | regEdit->setFont( f ); |
1227 | searchEdit->setFont( f ); | 1227 | searchEdit->setFont( f ); |
1228 | reader->m_fontname = lcn; | 1228 | reader->m_fontname = lcn; |
1229 | reader->ChangeFont(reader->fontsizes[reader->m_textsize]); | 1229 | reader->ChangeFont(reader->fontsizes[reader->m_textsize]); |
1230 | reader->refresh(); | 1230 | reader->refresh(); |
1231 | m_fontBar->hide(); | 1231 | m_fontBar->hide(); |
1232 | m_fontVisible = false; | 1232 | m_fontVisible = false; |
1233 | showEditTools(); | 1233 | showEditTools(); |
1234 | } | 1234 | } |
1235 | 1235 | ||
1236 | void QTReaderApp::do_autogen(const QString& regText) | 1236 | void QTReaderApp::do_autogen(const QString& regText) |
1237 | { | 1237 | { |
1238 | unsigned long fs, ts; | 1238 | unsigned long fs, ts; |
1239 | reader->sizes(fs,ts); | 1239 | reader->sizes(fs,ts); |
1240 | // qDebug("Reg:%s\n", (const tchar*)(regEdit->text())); | 1240 | // qDebug("Reg:%s\n", (const tchar*)(regEdit->text())); |
1241 | m_autogenstr = regText; | 1241 | m_autogenstr = regText; |
1242 | QRegExp re(regText); | 1242 | QRegExp re(regText); |
1243 | CBuffer buff; | 1243 | CBuffer buff; |
1244 | if (pBkmklist != NULL) delete pBkmklist; | 1244 | if (pBkmklist != NULL) delete pBkmklist; |
1245 | pBkmklist = new CList<Bkmk>; | 1245 | pBkmklist = new CList<Bkmk>; |
1246 | m_fBkmksChanged = true; | 1246 | m_fBkmksChanged = true; |
1247 | pbar->show(); | 1247 | pbar->show(); |
1248 | pbar->resize(width(), editBar->height()); | 1248 | pbar->resize(width(), editBar->height()); |
1249 | pbar->reset(); | 1249 | pbar->reset(); |
1250 | qApp->processEvents(); | 1250 | qApp->processEvents(); |
1251 | reader->setFocus(); | 1251 | reader->setFocus(); |
1252 | reader->jumpto(0); | 1252 | reader->jumpto(0); |
1253 | int lastpc = 0; | 1253 | int lastpc = 0; |
1254 | int i = 0; | 1254 | int i = 0; |
1255 | while (i >= 0) | 1255 | while (i >= 0) |
1256 | { | 1256 | { |
1257 | unsigned int lcn = reader->locate(); | 1257 | unsigned int lcn = reader->locate(); |
1258 | int pc = (100*lcn)/ts; | 1258 | int pc = (100*lcn)/ts; |
1259 | if (pc != lastpc) | 1259 | if (pc != lastpc) |
1260 | { | 1260 | { |
1261 | pbar->setProgress(pc); | 1261 | pbar->setProgress(pc); |
1262 | qApp->processEvents(); | 1262 | qApp->processEvents(); |
1263 | if (reader->locate() != lcn) reader->jumpto(lcn); | 1263 | if (reader->locate() != lcn) reader->jumpto(lcn); |
1264 | reader->setFocus(); | 1264 | reader->setFocus(); |
1265 | lastpc = pc; | 1265 | lastpc = pc; |
1266 | } | 1266 | } |
1267 | i = reader->buffdoc.getpara(buff); | 1267 | i = reader->buffdoc.getpara(buff); |
1268 | #ifdef _UNICODE | 1268 | #ifdef _UNICODE |
1269 | if (re.match(toQString(buff.data())) != -1) | 1269 | if (re.match(toQString(buff.data())) != -1) |
1270 | #else | 1270 | #else |
1271 | if (re.match(buff.data()) != -1) | 1271 | if (re.match(buff.data()) != -1) |
1272 | #endif | 1272 | #endif |
1273 | pBkmklist->push_back(Bkmk(buff.data(),lcn)); | 1273 | pBkmklist->push_back(Bkmk(buff.data(),lcn)); |
1274 | } | 1274 | } |
1275 | pbar->setProgress(100); | 1275 | pbar->setProgress(100); |
1276 | qApp->processEvents(); | 1276 | qApp->processEvents(); |
1277 | pbar->hide(); | 1277 | pbar->hide(); |
1278 | } | 1278 | } |
1279 | 1279 | ||
1280 | void QTReaderApp::saveprefs() | 1280 | void QTReaderApp::saveprefs() |
1281 | { | 1281 | { |
1282 | // reader->saveprefs("uqtreader"); | 1282 | // reader->saveprefs("uqtreader"); |
1283 | Config config( "uqtreader" ); | 1283 | Config config( "uqtreader" ); |
1284 | config.setGroup( "View" ); | 1284 | config.setGroup( "View" ); |
1285 | 1285 | ||
1286 | reader->m_lastposn = reader->pagelocate(); | 1286 | reader->m_lastposn = reader->pagelocate(); |
1287 | 1287 | ||
1288 | config.writeEntry( "StripCr", reader->bstripcr ); | 1288 | config.writeEntry( "StripCr", reader->bstripcr ); |
1289 | config.writeEntry( "StripHtml", reader->bstriphtml ); | 1289 | config.writeEntry( "StripHtml", reader->bstriphtml ); |
1290 | config.writeEntry( "Dehyphen", reader->bdehyphen ); | 1290 | config.writeEntry( "Dehyphen", reader->bdehyphen ); |
1291 | config.writeEntry( "Unindent", reader->bunindent ); | 1291 | config.writeEntry( "Unindent", reader->bunindent ); |
1292 | config.writeEntry( "Repara", reader->brepara ); | 1292 | config.writeEntry( "Repara", reader->brepara ); |
1293 | config.writeEntry( "DoubleSpace", reader->bdblspce ); | 1293 | config.writeEntry( "DoubleSpace", reader->bdblspce ); |
1294 | config.writeEntry( "Indent", reader->bindenter ); | 1294 | config.writeEntry( "Indent", reader->bindenter ); |
1295 | config.writeEntry( "FontSize", (int)(reader->fontsizes[reader->m_textsize]) ); | 1295 | config.writeEntry( "FontSize", (int)(reader->fontsizes[reader->m_textsize]) ); |
1296 | config.writeEntry( "Bold", reader->m_bBold ); | 1296 | config.writeEntry( "Bold", reader->m_bBold ); |
1297 | config.writeEntry( "ScrollDelay", reader->m_delay); | 1297 | config.writeEntry( "ScrollDelay", reader->m_delay); |
@@ -1313,121 +1313,121 @@ void QTReaderApp::indentplus() | |||
1313 | } | 1313 | } |
1314 | 1314 | ||
1315 | void QTReaderApp::indentminus() | 1315 | void QTReaderApp::indentminus() |
1316 | { | 1316 | { |
1317 | reader->indentminus(); | 1317 | reader->indentminus(); |
1318 | } | 1318 | } |
1319 | 1319 | ||
1320 | /* | 1320 | /* |
1321 | void QTReaderApp::oldFile() | 1321 | void QTReaderApp::oldFile() |
1322 | { | 1322 | { |
1323 | qDebug("oldFile called"); | 1323 | qDebug("oldFile called"); |
1324 | reader->setText(true); | 1324 | reader->setText(true); |
1325 | qDebug("settext called"); | 1325 | qDebug("settext called"); |
1326 | showEditTools(); | 1326 | showEditTools(); |
1327 | qDebug("showedit called"); | 1327 | qDebug("showedit called"); |
1328 | } | 1328 | } |
1329 | */ | 1329 | */ |
1330 | 1330 | ||
1331 | /* | 1331 | /* |
1332 | void info_cb(Fl_Widget* o, void* _data) | 1332 | void info_cb(Fl_Widget* o, void* _data) |
1333 | { | 1333 | { |
1334 | 1334 | ||
1335 | if (infowin == NULL) | 1335 | if (infowin == NULL) |
1336 | { | 1336 | { |
1337 | 1337 | ||
1338 | infowin = new Fl_Window(160,240); | 1338 | infowin = new Fl_Window(160,240); |
1339 | filename = new Fl_Output(45,5,110,14,"Filename"); | 1339 | filename = new Fl_Output(45,5,110,14,"Filename"); |
1340 | filesize = new Fl_Output(45,25,110,14,"Filesize"); | 1340 | filesize = new Fl_Output(45,25,110,14,"Filesize"); |
1341 | textsize = new Fl_Output(45,45,110,14,"Textsize"); | 1341 | textsize = new Fl_Output(45,45,110,14,"Textsize"); |
1342 | comprat = new CBar(45,65,110,14,"Ratio %"); | 1342 | comprat = new CBar(45,65,110,14,"Ratio %"); |
1343 | posn = new Fl_Output(45,85,110,14,"Location"); | 1343 | posn = new Fl_Output(45,85,110,14,"Location"); |
1344 | frcn = new CBar(45,105,110,14,"% Read"); | 1344 | frcn = new CBar(45,105,110,14,"% Read"); |
1345 | about = new Fl_Multiline_Output(5,125,150,90); | 1345 | about = new Fl_Multiline_Output(5,125,150,90); |
1346 | about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files"); | 1346 | about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files"); |
1347 | Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay"); | 1347 | Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay"); |
1348 | infowin->set_modal(); | 1348 | infowin->set_modal(); |
1349 | } | 1349 | } |
1350 | if (((reader_ui *)_data)->g_filename[0] != '\0') | 1350 | if (((reader_ui *)_data)->g_filename[0] != '\0') |
1351 | { | 1351 | { |
1352 | unsigned long fs,ts; | 1352 | unsigned long fs,ts; |
1353 | tchar sz[20]; | 1353 | tchar sz[20]; |
1354 | ((reader_ui *)_data)->input->sizes(fs,ts); | 1354 | ((reader_ui *)_data)->input->sizes(fs,ts); |
1355 | unsigned long pl = ((reader_ui *)_data)->input->locate(); | 1355 | unsigned long pl = ((reader_ui *)_data)->input->locate(); |
1356 | 1356 | ||
1357 | filename->value(((reader_ui *)_data)->g_filename); | 1357 | filename->value(((reader_ui *)_data)->g_filename); |
1358 | 1358 | ||
1359 | sprintf(sz,"%u",fs); | 1359 | sprintf(sz,"%u",fs); |
1360 | filesize->value(sz); | 1360 | filesize->value(sz); |
1361 | 1361 | ||
1362 | sprintf(sz,"%u",ts); | 1362 | sprintf(sz,"%u",ts); |
1363 | textsize->value(sz); | 1363 | textsize->value(sz); |
1364 | 1364 | ||
1365 | comprat->value(100-(100*fs + (ts >> 1))/ts); | 1365 | comprat->value(100-(100*fs + (ts >> 1))/ts); |
1366 | 1366 | ||
1367 | sprintf(sz,"%u",pl); | 1367 | sprintf(sz,"%u",pl); |
1368 | posn->value(sz); | 1368 | posn->value(sz); |
1369 | 1369 | ||
1370 | frcn->value((100*pl + (ts >> 1))/ts); | 1370 | frcn->value((100*pl + (ts >> 1))/ts); |
1371 | } | 1371 | } |
1372 | infowin->show(); | 1372 | infowin->show(); |
1373 | } | 1373 | } |
1374 | */ | 1374 | */ |
1375 | 1375 | ||
1376 | void QTReaderApp::savebkmks() | 1376 | void QTReaderApp::savebkmks() |
1377 | { | 1377 | { |
1378 | if (pBkmklist != NULL) | 1378 | if (pBkmklist != NULL) |
1379 | { | 1379 | { |
1380 | BkmkFile bf((const char *)Global::applicationFileName("uqtreader",reader->m_string), true); | 1380 | BkmkFile bf((const char *)Global::applicationFileName("uqtreader",reader->m_string), true); |
1381 | bf.write(*pBkmklist); | 1381 | bf.write(*pBkmklist); |
1382 | } | 1382 | } |
1383 | m_fBkmksChanged = false; | 1383 | m_fBkmksChanged = false; |
1384 | } | 1384 | } |
1385 | 1385 | ||
1386 | void QTReaderApp::readbkmks() | 1386 | void QTReaderApp::readbkmks() |
1387 | { | 1387 | { |
1388 | if (pBkmklist != NULL) | 1388 | if (pBkmklist != NULL) |
1389 | { | 1389 | { |
1390 | delete pBkmklist; | 1390 | delete pBkmklist; |
1391 | } | 1391 | } |
1392 | BkmkFile bf((const char *)Global::applicationFileName("uqtreader",reader->m_string)); | 1392 | BkmkFile bf((const char *)Global::applicationFileName("uqtreader",reader->m_string)); |
1393 | pBkmklist = bf.readall(); | 1393 | pBkmklist = bf.readall(); |
1394 | m_fBkmksChanged = false; | 1394 | m_fBkmksChanged = false; |
1395 | if (pBkmklist == NULL) | 1395 | if (pBkmklist == NULL) |
1396 | { | 1396 | { |
1397 | pBkmklist = reader->getbkmklist(); | 1397 | pBkmklist = reader->getbkmklist(); |
1398 | } | 1398 | } |
1399 | if (pBkmklist != NULL) | 1399 | if (pBkmklist != NULL) |
1400 | pBkmklist->sort(); | 1400 | pBkmklist->sort(); |
1401 | } | 1401 | } |
1402 | 1402 | ||
1403 | void QTReaderApp::addbkmk() | 1403 | void QTReaderApp::addbkmk() |
1404 | { | 1404 | { |
1405 | m_nRegAction = cAddBkmk; | 1405 | m_nRegAction = cAddBkmk; |
1406 | regEdit->setText(reader->firstword()); | 1406 | regEdit->setText(reader->firstword()); |
1407 | do_regedit(); | 1407 | do_regedit(); |
1408 | } | 1408 | } |
1409 | 1409 | ||
1410 | void QTReaderApp::do_addbkmk(const QString& text) | 1410 | void QTReaderApp::do_addbkmk(const QString& text) |
1411 | { | 1411 | { |
1412 | if (text.isEmpty()) | 1412 | if (text.isEmpty()) |
1413 | { | 1413 | { |
1414 | QMessageBox::information(this, "QTReader", "Need a name for the bookmark\nSelect add again", 1); | 1414 | QMessageBox::information(this, "QTReader", "Need a name for the bookmark\nSelect add again", 1); |
1415 | } | 1415 | } |
1416 | else | 1416 | else |
1417 | { | 1417 | { |
1418 | if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>; | 1418 | if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>; |
1419 | #ifdef _UNICODE | 1419 | #ifdef _UNICODE |
1420 | CBuffer buff; | 1420 | CBuffer buff; |
1421 | int i = 0; | 1421 | int i = 0; |
1422 | for (i = 0; i < text.length(); i++) | 1422 | for (i = 0; i < text.length(); i++) |
1423 | { | 1423 | { |
1424 | buff[i] = text[i].unicode(); | 1424 | buff[i] = text[i].unicode(); |
1425 | } | 1425 | } |
1426 | buff[i] = 0; | 1426 | buff[i] = 0; |
1427 | pBkmklist->push_front(Bkmk(buff.data(), reader->pagelocate())); | 1427 | pBkmklist->push_front(Bkmk(buff.data(), reader->pagelocate())); |
1428 | #else | 1428 | #else |
1429 | pBkmklist->push_front(Bkmk((const tchar*)text,reader->pagelocate())); | 1429 | pBkmklist->push_front(Bkmk((const tchar*)text,reader->pagelocate())); |
1430 | #endif | 1430 | #endif |
1431 | m_fBkmksChanged = true; | 1431 | m_fBkmksChanged = true; |
1432 | } | 1432 | } |
1433 | } | 1433 | } |