author | pohly <pohly> | 2005-05-05 14:39:33 (UTC) |
---|---|---|
committer | pohly <pohly> | 2005-05-05 14:39:33 (UTC) |
commit | 39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91 (patch) (unidiff) | |
tree | 96e66fdc18dca4d4ab8611133e072f57dea224b9 /noncore/apps/opie-reader/QTReaderApp.cpp | |
parent | 279fc4fd1986074acbadd3a8e86fcf3968a8dd5c (diff) | |
download | opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.zip opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.tar.gz opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.tar.bz2 |
new opie-reader sources with support for ArriereGo, Reb input and flite output plugins
Diffstat (limited to 'noncore/apps/opie-reader/QTReaderApp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/QTReaderApp.cpp | 246 |
1 files changed, 176 insertions, 70 deletions
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp index 876b65a..6753698 100644 --- a/noncore/apps/opie-reader/QTReaderApp.cpp +++ b/noncore/apps/opie-reader/QTReaderApp.cpp | |||
@@ -16,8 +16,9 @@ | |||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | |||
20 | #include <qregexp.h> | 21 | #include <qregexp.h> |
21 | #include <qclipboard.h> | 22 | #include <qclipboard.h> |
22 | #include <qwidgetstack.h> | 23 | #include <qwidgetstack.h> |
23 | #ifdef USEQPE | 24 | #ifdef USEQPE |
@@ -65,18 +66,23 @@ | |||
65 | #include "FixedFont.h" | 66 | #include "FixedFont.h" |
66 | #include "URLDialog.h" | 67 | #include "URLDialog.h" |
67 | #include "util.h" | 68 | #include "util.h" |
68 | #include <qfontdatabase.h> | 69 | #include <qfontdatabase.h> |
70 | |||
69 | #ifdef USEQPE | 71 | #ifdef USEQPE |
70 | #include <qpe/resource.h> | 72 | #include <qpe/resource.h> |
71 | #ifdef OPIE | 73 | #ifdef OPIE |
72 | //#include <qpe/applnk.h> | 74 | #if defined(OPIEFILEDIALOG) |
75 | #include <qpe/applnk.h> | ||
73 | #include <opie2/ofiledialog.h> | 76 | #include <opie2/ofiledialog.h> |
74 | using namespace Opie::Ui; | 77 | using namespace Opie::Ui; |
75 | #else | 78 | #else |
76 | #include "fileBrowser.h" | 79 | #include "fileBrowser.h" |
77 | #endif | 80 | #endif |
78 | #else | 81 | #else |
82 | #include "fileBrowser.h" | ||
83 | #endif | ||
84 | #else | ||
79 | #include "qfiledialog.h" | 85 | #include "qfiledialog.h" |
80 | #endif | 86 | #endif |
81 | 87 | ||
82 | #include "QTReaderApp.h" | 88 | #include "QTReaderApp.h" |
@@ -87,9 +93,9 @@ using namespace Opie::Ui; | |||
87 | #include "CloseDialog.h" | 93 | #include "CloseDialog.h" |
88 | 94 | ||
89 | #include "ButtonPrefs.h" | 95 | #include "ButtonPrefs.h" |
90 | 96 | ||
91 | bool CheckVersion(int&, int&, char&); | 97 | bool CheckVersion(int&, int&, char&, QWidget*); |
92 | 98 | ||
93 | #ifdef _WINDOWS | 99 | #ifdef _WINDOWS |
94 | #define PICDIR "c:\\uqtreader\\pics\\" | 100 | #define PICDIR "c:\\uqtreader\\pics\\" |
95 | #else | 101 | #else |
@@ -152,13 +158,11 @@ void QTReaderApp::listBkmkFiles() | |||
152 | 158 | ||
153 | const QFileInfoList *list = d.entryInfoList(); | 159 | const QFileInfoList *list = d.entryInfoList(); |
154 | QFileInfoListIterator it( *list ); // create list iterator | 160 | QFileInfoListIterator it( *list ); // create list iterator |
155 | QFileInfo *fi; // pointer for traversing | 161 | QFileInfo *fi; // pointer for traversing |
156 | |||
157 | while ( (fi=it.current()) ) { // for each file... | 162 | while ( (fi=it.current()) ) { // for each file... |
158 | 163 | ||
159 | bkmkselector->insertItem(fi->fileName()); | 164 | bkmkselector->insertItem(fi->fileName(), cnt++); |
160 | cnt++; | ||
161 | 165 | ||
162 | //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); | 166 | //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); |
163 | ++it; // goto next list element | 167 | ++it; // goto next list element |
164 | } | 168 | } |
@@ -176,10 +180,9 @@ void QTReaderApp::listBkmkFiles() | |||
176 | if (de == NULL) break; | 180 | if (de == NULL) break; |
177 | 181 | ||
178 | if (lstat((const char *)Global::applicationFileName(APPDIR,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) | 182 | if (lstat((const char *)Global::applicationFileName(APPDIR,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) |
179 | { | 183 | { |
180 | bkmkselector->insertItem(de->d_name); | 184 | bkmkselector->insertItem(de->d_name, cnt++); |
181 | cnt++; | ||
182 | } | 185 | } |
183 | } | 186 | } |
184 | 187 | ||
185 | closedir(d); | 188 | closedir(d); |
@@ -201,9 +204,9 @@ void QTReaderApp::hidetoolbars() | |||
201 | { | 204 | { |
202 | if (m_scrollbar != NULL) m_scrollbar->hide(); | 205 | if (m_scrollbar != NULL) m_scrollbar->hide(); |
203 | if (m_prog != NULL) m_prog->hide(); | 206 | if (m_prog != NULL) m_prog->hide(); |
204 | 207 | ||
205 | #ifdef USEQPE | 208 | #if defined(USEQPE) |
206 | menubar->hide(); | 209 | menubar->hide(); |
207 | #endif | 210 | #endif |
208 | 211 | ||
209 | if (m_scrollbar != NULL) m_scrollbar->hide(); | 212 | if (m_scrollbar != NULL) m_scrollbar->hide(); |
@@ -332,16 +335,16 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
332 | // QToolBar* viewBar = new QToolBar("File", this); | 335 | // QToolBar* viewBar = new QToolBar("File", this); |
333 | // QToolBar* navBar = new QToolBar("File", this); | 336 | // QToolBar* navBar = new QToolBar("File", this); |
334 | // QToolBar* markBar = new QToolBar("File", this); | 337 | // QToolBar* markBar = new QToolBar("File", this); |
335 | 338 | ||
336 | #ifdef USEQPE | 339 | #if defined(USEQPE) |
337 | menubar = new QToolBar("Menus", this, m_tbposition); | 340 | menubar = new QToolBar("Menus", this, m_tbposition); |
338 | mb = new QPEMenuBar( menubar ); | 341 | mb = new QPEMenuBar( menubar ); |
339 | #else | 342 | #else |
340 | mb = new QMenuBar( this ); | 343 | mb = new QMenuBar( this ); |
341 | #endif | 344 | #endif |
342 | 345 | ||
343 | #ifdef USEQPE | 346 | #if defined(USEQPE) |
344 | QPopupMenu* tmp = new QPopupMenu(mb); | 347 | QPopupMenu* tmp = new QPopupMenu(mb); |
345 | mb->insertItem( geticon( "AppsIcon" ), tmp ); | 348 | mb->insertItem( geticon( "AppsIcon" ), tmp ); |
346 | #else | 349 | #else |
347 | QMenuBar* tmp = mb; | 350 | QMenuBar* tmp = mb; |
@@ -435,8 +438,11 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
435 | 438 | ||
436 | // qDebug("Reading config"); | 439 | // qDebug("Reading config"); |
437 | // Config config( APPDIR ); | 440 | // Config config( APPDIR ); |
438 | config.setGroup( "View" ); | 441 | config.setGroup( "View" ); |
442 | #if defined(USEQPE) && defined(USENEWFULLSCREEN) | ||
443 | m_usenewfullscreen = config.readBoolEntry("NewFullScreen", false); | ||
444 | #endif | ||
439 | m_debounce = config.readNumEntry("Debounce", 0); | 445 | m_debounce = config.readNumEntry("Debounce", 0); |
440 | m_buttonprefs->Debounce(m_debounce); | 446 | m_buttonprefs->Debounce(m_debounce); |
441 | #ifdef USEQPE | 447 | #ifdef USEQPE |
442 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); | 448 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); |
@@ -455,8 +461,9 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
455 | reader->setlead(config.readNumEntry( "ExtraLead", 0 )); | 461 | reader->setlead(config.readNumEntry( "ExtraLead", 0 )); |
456 | reader->btextfmt = config.readBoolEntry( "TextFmt", false ); | 462 | reader->btextfmt = config.readBoolEntry( "TextFmt", false ); |
457 | reader->bautofmt = config.readBoolEntry( "AutoFmt", true ); | 463 | reader->bautofmt = config.readBoolEntry( "AutoFmt", true ); |
458 | reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); | 464 | reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); |
465 | reader->bNoInlineTables = config.readBoolEntry( "NoInlineTables", false ); | ||
459 | reader->bpeanut = config.readBoolEntry( "Peanut", false ); | 466 | reader->bpeanut = config.readBoolEntry( "Peanut", false ); |
460 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); | 467 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); |
461 | reader->bdepluck = config.readBoolEntry( "Depluck", false ); | 468 | reader->bdepluck = config.readBoolEntry( "Depluck", false ); |
462 | reader->bdejpluck = config.readBoolEntry( "Dejpluck", false ); | 469 | reader->bdejpluck = config.readBoolEntry( "Dejpluck", false ); |
@@ -470,8 +477,10 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
470 | reader->bindenter = config.readNumEntry( "Indent", 0 ); | 477 | reader->bindenter = config.readNumEntry( "Indent", 0 ); |
471 | reader->m_textsize = config.readNumEntry( "FontSize", 12 ); | 478 | reader->m_textsize = config.readNumEntry( "FontSize", 12 ); |
472 | reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); | 479 | reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); |
473 | reader->m_scrollstep = config.readNumEntry( "ScrollStep", 1); | 480 | reader->m_scrollstep = config.readNumEntry( "ScrollStep", 1); |
481 | reader->m_outputName = config.readEntry( "OutputCodec", ""); | ||
482 | |||
474 | 483 | ||
475 | reader->m_lastfile = config.readEntry( "LastFile", QString::null ); | 484 | reader->m_lastfile = config.readEntry( "LastFile", QString::null ); |
476 | reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); | 485 | reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); |
477 | reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); | 486 | reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); |
@@ -499,14 +508,17 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
499 | reader->m_absleft_border = config.readNumEntry( "Left Margin", 100 ); | 508 | reader->m_absleft_border = config.readNumEntry( "Left Margin", 100 ); |
500 | reader->m_absright_border = config.readNumEntry( "Right Margin", 100 ); | 509 | reader->m_absright_border = config.readNumEntry( "Right Margin", 100 ); |
501 | 510 | ||
502 | m_scrollishidden = config.readBoolEntry( "HideScrollBar", false ); | 511 | m_scrollishidden = config.readBoolEntry( "HideScrollBar", false ); |
512 | m_hidebars = config.readBoolEntry( "HideToolBar", false ); | ||
503 | 513 | ||
504 | reader->brepalm = config.readBoolEntry( "Repalm", false ); | 514 | reader->brepalm = config.readBoolEntry( "Repalm", false ); |
515 | reader->bunderlineLink = config.readBoolEntry( "UnderlineLink", true ); | ||
505 | reader->bkern = config.readBoolEntry( "Kern", false ); | 516 | reader->bkern = config.readBoolEntry( "Kern", false ); |
506 | reader->bremap = config.readBoolEntry( "Remap", true ); | 517 | reader->bremap = config.readBoolEntry( "Remap", true ); |
507 | reader->bmakebold = config.readBoolEntry( "MakeBold", false ); | 518 | reader->bmakebold = config.readBoolEntry( "MakeBold", false ); |
508 | reader->setContinuous(config.readBoolEntry( "Continuous", true )); | 519 | reader->setContinuous(config.readBoolEntry( "Continuous", true )); |
520 | reader->setDoubleBuffer(config.readBoolEntry("DoubleBuffer", true)); | ||
509 | m_targetapp = config.readEntry( "TargetApp", QString::null ); | 521 | m_targetapp = config.readEntry( "TargetApp", QString::null ); |
510 | m_targetmsg = config.readEntry( "TargetMsg", QString::null ); | 522 | m_targetmsg = config.readEntry( "TargetMsg", QString::null ); |
511 | #ifdef _SCROLLPIPE | 523 | #ifdef _SCROLLPIPE |
512 | reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null ); | 524 | reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null ); |
@@ -515,8 +527,9 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
515 | m_twoTouch = config.readBoolEntry( "TwoTouch", false); | 527 | m_twoTouch = config.readBoolEntry( "TwoTouch", false); |
516 | m_doAnnotation = config.readBoolEntry( "Annotation", false); | 528 | m_doAnnotation = config.readBoolEntry( "Annotation", false); |
517 | m_doDictionary = config.readBoolEntry( "Dictionary", false); | 529 | m_doDictionary = config.readBoolEntry( "Dictionary", false); |
518 | m_doClipboard = config.readBoolEntry( "Clipboard", false); | 530 | m_doClipboard = config.readBoolEntry( "Clipboard", false); |
531 | m_doOutput = config.readBoolEntry( "OutputTgt", false); | ||
519 | /* | 532 | /* |
520 | m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll); | 533 | m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll); |
521 | m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone); | 534 | m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone); |
522 | m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen); | 535 | m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen); |
@@ -841,8 +854,20 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
841 | 854 | ||
842 | 855 | ||
843 | setToolBarsMovable(m_tbmove); | 856 | setToolBarsMovable(m_tbmove); |
844 | addtoolbars(&config); | 857 | addtoolbars(&config); |
858 | if (m_hidebars) | ||
859 | { | ||
860 | #if defined(USEQPE) | ||
861 | menubar->hide(); | ||
862 | #endif | ||
863 | if (fileBar != NULL) fileBar->hide(); | ||
864 | if (viewBar != NULL) viewBar->hide(); | ||
865 | if (navBar != NULL) navBar->hide(); | ||
866 | if (markBar != NULL) markBar->hide(); | ||
867 | mb->hide(); | ||
868 | } | ||
869 | |||
845 | 870 | ||
846 | pbar = new QProgressBar(this); | 871 | pbar = new QProgressBar(this); |
847 | pbar->hide(); | 872 | pbar->hide(); |
848 | 873 | ||
@@ -971,8 +996,9 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
971 | // qDebug("fonted"); | 996 | // qDebug("fonted"); |
972 | QFont progfont(reader->m_fontname, reader->m_fontControl.getsize(0)); | 997 | QFont progfont(reader->m_fontname, reader->m_fontControl.getsize(0)); |
973 | m_prog->setFont( progfont ); | 998 | m_prog->setFont( progfont ); |
974 | if (m_statusishidden) m_prog->hide(); | 999 | if (m_statusishidden) m_prog->hide(); |
1000 | showEditTools(); | ||
975 | if (!reader->m_lastfile.isEmpty()) | 1001 | if (!reader->m_lastfile.isEmpty()) |
976 | { | 1002 | { |
977 | //qDebug("doclnk"); | 1003 | //qDebug("doclnk"); |
978 | //doc = new DocLnk(reader->m_lastfile); | 1004 | //doc = new DocLnk(reader->m_lastfile); |
@@ -1031,15 +1057,15 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
1031 | else | 1057 | else |
1032 | { | 1058 | { |
1033 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; | 1059 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; |
1034 | } | 1060 | } |
1035 | reader->bDoUpdates = true; | 1061 | // reader->bDoUpdates = true; |
1036 | reader->update(); | 1062 | // reader->update(); |
1037 | config.setGroup("Version"); | 1063 | config.setGroup("Version"); |
1038 | int major = config.readNumEntry("Major", 0); | 1064 | int major = config.readNumEntry("Major", 0); |
1039 | int bkmktype = config.readNumEntry("BkmkType", 0); | 1065 | int bkmktype = config.readNumEntry("BkmkType", 0); |
1040 | char minor = config.readNumEntry("Minor", 0); | 1066 | char minor = config.readNumEntry("Minor", 0); |
1041 | if (CheckVersion(major, bkmktype, minor)) | 1067 | if (CheckVersion(major, bkmktype, minor, this)) |
1042 | { | 1068 | { |
1043 | config.writeEntry("Major", major); | 1069 | config.writeEntry("Major", major); |
1044 | config.writeEntry("BkmkType", bkmktype); | 1070 | config.writeEntry("BkmkType", bkmktype); |
1045 | config.writeEntry("Minor", (int)minor); | 1071 | config.writeEntry("Minor", (int)minor); |
@@ -1064,9 +1090,9 @@ void QTReaderApp::addtoolbars(Config* config) | |||
1064 | config->setGroup("Toolbar"); | 1090 | config->setGroup("Toolbar"); |
1065 | 1091 | ||
1066 | if (fileBar != NULL) | 1092 | if (fileBar != NULL) |
1067 | { | 1093 | { |
1068 | #ifdef USEQPE | 1094 | #if defined(USEQPE) |
1069 | if (fileBar != menubar) | 1095 | if (fileBar != menubar) |
1070 | { | 1096 | { |
1071 | fileBar->clear(); | 1097 | fileBar->clear(); |
1072 | } | 1098 | } |
@@ -1092,9 +1118,9 @@ void QTReaderApp::addtoolbars(Config* config) | |||
1092 | addfilebar(config, "Find", m_find_action); | 1118 | addfilebar(config, "Find", m_find_action); |
1093 | 1119 | ||
1094 | if (navBar != NULL) | 1120 | if (navBar != NULL) |
1095 | { | 1121 | { |
1096 | #ifdef USEQPE | 1122 | #if defined(USEQPE) |
1097 | if ((navBar == fileBar) && (fileBar == menubar)) | 1123 | if ((navBar == fileBar) && (fileBar == menubar)) |
1098 | #else | 1124 | #else |
1099 | if (navBar == fileBar) | 1125 | if (navBar == fileBar) |
1100 | #endif | 1126 | #endif |
@@ -1131,9 +1157,9 @@ void QTReaderApp::addtoolbars(Config* config) | |||
1131 | addnavbar(config, "Forward", m_forward_action); | 1157 | addnavbar(config, "Forward", m_forward_action); |
1132 | 1158 | ||
1133 | if (viewBar != NULL) | 1159 | if (viewBar != NULL) |
1134 | { | 1160 | { |
1135 | #ifdef USEQPE | 1161 | #if defined(USEQPE) |
1136 | if ((viewBar == fileBar) && (fileBar == menubar)) | 1162 | if ((viewBar == fileBar) && (fileBar == menubar)) |
1137 | #else | 1163 | #else |
1138 | if (viewBar == fileBar) | 1164 | if (viewBar == fileBar) |
1139 | #endif | 1165 | #endif |
@@ -1163,9 +1189,9 @@ void QTReaderApp::addtoolbars(Config* config) | |||
1163 | addviewbar(config, "Ideogram Mode", m_setmono_action); | 1189 | addviewbar(config, "Ideogram Mode", m_setmono_action); |
1164 | 1190 | ||
1165 | if (markBar != NULL) | 1191 | if (markBar != NULL) |
1166 | { | 1192 | { |
1167 | #ifdef USEQPE | 1193 | #if defined(USEQPE) |
1168 | if ((markBar == fileBar) && (fileBar == menubar)) | 1194 | if ((markBar == fileBar) && (fileBar == menubar)) |
1169 | #else | 1195 | #else |
1170 | if (markBar == fileBar) | 1196 | if (markBar == fileBar) |
1171 | #endif | 1197 | #endif |
@@ -1232,9 +1258,9 @@ QToolBar* QTReaderApp::filebar() | |||
1232 | if (fileBar == NULL) | 1258 | if (fileBar == NULL) |
1233 | { | 1259 | { |
1234 | switch (m_tbpol) | 1260 | switch (m_tbpol) |
1235 | { | 1261 | { |
1236 | #ifdef USEQPE | 1262 | #if defined(USEQPE) |
1237 | case cesSingle: | 1263 | case cesSingle: |
1238 | // qDebug("Setting filebar to menubar"); | 1264 | // qDebug("Setting filebar to menubar"); |
1239 | fileBar = menubar; | 1265 | fileBar = menubar; |
1240 | break; | 1266 | break; |
@@ -1716,9 +1742,8 @@ void QTReaderApp::setrotated(bool sfs) | |||
1716 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopagedn()) ); | 1742 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopagedn()) ); |
1717 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); | 1743 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); |
1718 | } | 1744 | } |
1719 | //reader->repaint(0, reader->m_left_border, reader->width(), reader->height()-2*reader->m_border); | 1745 | //reader->repaint(0, reader->m_left_border, reader->width(), reader->height()-2*reader->m_border); |
1720 | reader->repaint(); | ||
1721 | } | 1746 | } |
1722 | else | 1747 | else |
1723 | { | 1748 | { |
1724 | m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::RightToLeft : QBoxLayout::LeftToRight ); | 1749 | m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::RightToLeft : QBoxLayout::LeftToRight ); |
@@ -1732,11 +1757,10 @@ void QTReaderApp::setrotated(bool sfs) | |||
1732 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopageup()) ); | 1757 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopageup()) ); |
1733 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); | 1758 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); |
1734 | } | 1759 | } |
1735 | //reader->repaint(reader->m_border, 0, reader->width()-2*reader->m_border, reader->height()); | 1760 | //reader->repaint(reader->m_border, 0, reader->width()-2*reader->m_border, reader->height()); |
1736 | reader->repaint(); | ||
1737 | } | 1761 | } |
1738 | // reader->update(); | 1762 | reader->refresh(); |
1739 | } | 1763 | } |
1740 | 1764 | ||
1741 | void QTReaderApp::setgrab(bool sfs) | 1765 | void QTReaderApp::setgrab(bool sfs) |
1742 | { | 1766 | { |
@@ -1927,9 +1951,9 @@ void QTReaderApp::fileOpen2() | |||
1927 | bool usebrowser = true; | 1951 | bool usebrowser = true; |
1928 | if (pOpenlist != NULL) | 1952 | if (pOpenlist != NULL) |
1929 | { | 1953 | { |
1930 | m_nBkmkAction = cOpenFile; | 1954 | m_nBkmkAction = cOpenFile; |
1931 | if (listbkmk(pOpenlist, "Browse")) usebrowser = false; | 1955 | if (listbkmk(pOpenlist, "Browse", true)) usebrowser = false; |
1932 | } | 1956 | } |
1933 | if (usebrowser) | 1957 | if (usebrowser) |
1934 | { | 1958 | { |
1935 | QString fn = usefilebrowser(); | 1959 | QString fn = usefilebrowser(); |
@@ -1950,9 +1974,9 @@ QString QTReaderApp::usefilebrowser() | |||
1950 | QString s( QFileDialog::getOpenFileName( reader->m_lastfile, QString::null, this ) ); | 1974 | QString s( QFileDialog::getOpenFileName( reader->m_lastfile, QString::null, this ) ); |
1951 | return s; | 1975 | return s; |
1952 | #else | 1976 | #else |
1953 | QString fn; | 1977 | QString fn; |
1954 | #ifdef OPIE | 1978 | #if defined(OPIE) && defined(OPIEFILEDIALOG) |
1955 | QMap<QString, QStringList> mimeTypes; | 1979 | QMap<QString, QStringList> mimeTypes; |
1956 | QStringList etypes; | 1980 | QStringList etypes; |
1957 | etypes << "etext/*"; | 1981 | etypes << "etext/*"; |
1958 | mimeTypes.insert( tr("eText"), etypes ); | 1982 | mimeTypes.insert( tr("eText"), etypes ); |
@@ -2002,8 +2026,9 @@ void QTReaderApp::showprefs() | |||
2002 | 2026 | ||
2003 | // prefwin->Debounce(m_debounce); | 2027 | // prefwin->Debounce(m_debounce); |
2004 | prefwin->bgtype(m_bgtype); | 2028 | prefwin->bgtype(m_bgtype); |
2005 | prefwin->repalm(reader->brepalm); | 2029 | prefwin->repalm(reader->brepalm); |
2030 | prefwin->UnderlineLink(reader->bunderlineLink); | ||
2006 | prefwin->kern(reader->bkern); | 2031 | prefwin->kern(reader->bkern); |
2007 | prefwin->hyphenate(reader->hyphenate); | 2032 | prefwin->hyphenate(reader->hyphenate); |
2008 | // prefwin->customhyphen(reader->buffdoc.getCustomHyphen()); | 2033 | // prefwin->customhyphen(reader->buffdoc.getCustomHyphen()); |
2009 | prefwin->scrolltype(reader->m_scrolltype); | 2034 | prefwin->scrolltype(reader->m_scrolltype); |
@@ -2014,8 +2039,9 @@ void QTReaderApp::showprefs() | |||
2014 | prefwin->background(m_background); | 2039 | prefwin->background(m_background); |
2015 | prefwin->twotouch(m_twoTouch); | 2040 | prefwin->twotouch(m_twoTouch); |
2016 | prefwin->propfontchange(m_propogatefontchange); | 2041 | prefwin->propfontchange(m_propogatefontchange); |
2017 | prefwin->StripCR(reader->bstripcr); | 2042 | prefwin->StripCR(reader->bstripcr); |
2043 | prefwin->InlineTables(!reader->bNoInlineTables); | ||
2018 | prefwin->Dehyphen(reader->bdehyphen); | 2044 | prefwin->Dehyphen(reader->bdehyphen); |
2019 | prefwin->SingleSpace(reader->bonespace); | 2045 | prefwin->SingleSpace(reader->bonespace); |
2020 | prefwin->Unindent(reader->bunindent); | 2046 | prefwin->Unindent(reader->bunindent); |
2021 | prefwin->Reparagraph(reader->brepara); | 2047 | prefwin->Reparagraph(reader->brepara); |
@@ -2055,8 +2081,9 @@ void QTReaderApp::showprefs() | |||
2055 | } | 2081 | } |
2056 | prefwin->Depluck(reader->bdepluck); | 2082 | prefwin->Depluck(reader->bdepluck); |
2057 | prefwin->Dejpluck(reader->bdejpluck); | 2083 | prefwin->Dejpluck(reader->bdejpluck); |
2058 | prefwin->Continuous(reader->m_continuousDocument); | 2084 | prefwin->Continuous(reader->m_continuousDocument); |
2085 | prefwin->DoubleBuffer(reader->m_doubleBuffered); | ||
2059 | 2086 | ||
2060 | prefwin->dictApplication(m_targetapp); | 2087 | prefwin->dictApplication(m_targetapp); |
2061 | prefwin->dictMessage(m_targetmsg); | 2088 | prefwin->dictMessage(m_targetmsg); |
2062 | 2089 | ||
@@ -2069,8 +2096,9 @@ void QTReaderApp::showprefs() | |||
2069 | 2096 | ||
2070 | prefwin->miscannotation(m_doAnnotation); | 2097 | prefwin->miscannotation(m_doAnnotation); |
2071 | prefwin->miscdictionary(m_doDictionary); | 2098 | prefwin->miscdictionary(m_doDictionary); |
2072 | prefwin->miscclipboard(m_doClipboard); | 2099 | prefwin->miscclipboard(m_doClipboard); |
2100 | prefwin->miscoutput(m_doOutput); | ||
2073 | 2101 | ||
2074 | prefwin->SwapMouse(reader->m_swapmouse); | 2102 | prefwin->SwapMouse(reader->m_swapmouse); |
2075 | 2103 | ||
2076 | prefwin->Font(reader->m_fontname); | 2104 | prefwin->Font(reader->m_fontname); |
@@ -2084,12 +2112,16 @@ void QTReaderApp::showprefs() | |||
2084 | prefwin->encoding(reader->m_encd); | 2112 | prefwin->encoding(reader->m_encd); |
2085 | 2113 | ||
2086 | prefwin->ideogramwidth(reader->m_charpc); | 2114 | prefwin->ideogramwidth(reader->m_charpc); |
2087 | 2115 | ||
2116 | prefwin->outcodec(reader->m_outputName); | ||
2117 | |||
2088 | if (prefwin->exec()) | 2118 | if (prefwin->exec()) |
2089 | { | 2119 | { |
2090 | // m_debounce = prefwin->Debounce(); | 2120 | // m_debounce = prefwin->Debounce(); |
2091 | reader->brepalm = prefwin->repalm(); | 2121 | reader->brepalm = prefwin->repalm(); |
2122 | reader->bunderlineLink = prefwin->UnderlineLink(); | ||
2123 | |||
2092 | reader->bkern = prefwin->kern(); | 2124 | reader->bkern = prefwin->kern(); |
2093 | reader->hyphenate = prefwin->hyphenate(); | 2125 | reader->hyphenate = prefwin->hyphenate(); |
2094 | // reader->buffdoc.setCustomHyphen(prefwin->customhyphen()); | 2126 | // reader->buffdoc.setCustomHyphen(prefwin->customhyphen()); |
2095 | reader->m_scrolltype = prefwin->scrolltype(); | 2127 | reader->m_scrolltype = prefwin->scrolltype(); |
@@ -2106,8 +2138,9 @@ void QTReaderApp::showprefs() | |||
2106 | reader->setTwoTouch(m_twoTouch); | 2138 | reader->setTwoTouch(m_twoTouch); |
2107 | m_touch_action->setOn(m_twoTouch); | 2139 | m_touch_action->setOn(m_twoTouch); |
2108 | 2140 | ||
2109 | reader->bstripcr = prefwin->StripCR(); | 2141 | reader->bstripcr = prefwin->StripCR(); |
2142 | reader->bNoInlineTables = !prefwin->InlineTables(); | ||
2110 | reader->bdehyphen = prefwin->Dehyphen(); | 2143 | reader->bdehyphen = prefwin->Dehyphen(); |
2111 | reader->bonespace = prefwin->SingleSpace(); | 2144 | reader->bonespace = prefwin->SingleSpace(); |
2112 | reader->bunindent = prefwin->Unindent(); | 2145 | reader->bunindent = prefwin->Unindent(); |
2113 | reader->brepara = prefwin->Reparagraph(); | 2146 | reader->brepara = prefwin->Reparagraph(); |
@@ -2148,8 +2181,9 @@ void QTReaderApp::showprefs() | |||
2148 | } | 2181 | } |
2149 | reader->bdepluck = prefwin->Depluck(); | 2182 | reader->bdepluck = prefwin->Depluck(); |
2150 | reader->bdejpluck = prefwin->Dejpluck(); | 2183 | reader->bdejpluck = prefwin->Dejpluck(); |
2151 | reader->setContinuous(prefwin->Continuous()); | 2184 | reader->setContinuous(prefwin->Continuous()); |
2185 | reader->setDoubleBuffer(prefwin->DoubleBuffer()); | ||
2152 | 2186 | ||
2153 | /* | 2187 | /* |
2154 | m_leftScroll = prefwin->leftScroll(); | 2188 | m_leftScroll = prefwin->leftScroll(); |
2155 | m_rightScroll = prefwin->rightScroll(); | 2189 | m_rightScroll = prefwin->rightScroll(); |
@@ -2161,8 +2195,9 @@ void QTReaderApp::showprefs() | |||
2161 | 2195 | ||
2162 | m_doAnnotation = prefwin->miscannotation(); | 2196 | m_doAnnotation = prefwin->miscannotation(); |
2163 | m_doDictionary = prefwin->miscdictionary(); | 2197 | m_doDictionary = prefwin->miscdictionary(); |
2164 | m_doClipboard = prefwin->miscclipboard(); | 2198 | m_doClipboard = prefwin->miscclipboard(); |
2199 | m_doOutput = prefwin->miscoutput(); | ||
2165 | reader->m_swapmouse = prefwin->SwapMouse(); | 2200 | reader->m_swapmouse = prefwin->SwapMouse(); |
2166 | reader->setBaseSize(prefwin->gfxsize()); | 2201 | reader->setBaseSize(prefwin->gfxsize()); |
2167 | reader->m_overlap = prefwin->pageoverlap(); | 2202 | reader->m_overlap = prefwin->pageoverlap(); |
2168 | reader->m_bMonoSpaced = prefwin->ideogram(); | 2203 | reader->m_bMonoSpaced = prefwin->ideogram(); |
@@ -2182,8 +2217,17 @@ void QTReaderApp::showprefs() | |||
2182 | { | 2217 | { |
2183 | m_bgtype = (bground)prefwin->bgtype(); | 2218 | m_bgtype = (bground)prefwin->bgtype(); |
2184 | setBackgroundBitmap(); | 2219 | setBackgroundBitmap(); |
2185 | } | 2220 | } |
2221 | qDebug("OutCodec:%s", (const char*)prefwin->outcodec()); | ||
2222 | if (reader->m_outputName != prefwin->outcodec()) | ||
2223 | { | ||
2224 | if (reader->m_output != NULL) | ||
2225 | { | ||
2226 | QMessageBox::warning(this, PROGNAME, "Change of output codec\nrequires a restart"); | ||
2227 | } | ||
2228 | reader->m_outputName = prefwin->outcodec(); | ||
2229 | } | ||
2186 | delete prefwin; | 2230 | delete prefwin; |
2187 | reader->setfilter(reader->getfilter()); | 2231 | reader->setfilter(reader->getfilter()); |
2188 | reader->refresh(); | 2232 | reader->refresh(); |
2189 | } | 2233 | } |
@@ -2289,14 +2333,38 @@ void QTReaderApp::showinfo() | |||
2289 | pl = reader->pagelocate(); | 2333 | pl = reader->pagelocate(); |
2290 | dl = pl - reader->buffdoc.startSection(); | 2334 | dl = pl - reader->buffdoc.startSection(); |
2291 | m_infoWin->setFileSize(fs); | 2335 | m_infoWin->setFileSize(fs); |
2292 | m_infoWin->setTextSize(ts); | 2336 | m_infoWin->setTextSize(ts); |
2293 | m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); | 2337 | if (fs > UINT_MAX/100) |
2338 | { | ||
2339 | unsigned long t1 = (ts+50)/100; | ||
2340 | m_infoWin->setRatio(100-(fs + (t1 >> 1))/t1); | ||
2341 | } | ||
2342 | else | ||
2343 | { | ||
2344 | m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); | ||
2345 | } | ||
2294 | m_infoWin->setLocation(pl); | 2346 | m_infoWin->setLocation(pl); |
2295 | m_infoWin->setRead((100*pl + (ts >> 1))/ts); | 2347 | if (pl > UINT_MAX/100) |
2348 | { | ||
2349 | unsigned long t1 = (ts+50)/100; | ||
2350 | m_infoWin->setRead((pl + (t1 >> 1))/t1); | ||
2351 | } | ||
2352 | else | ||
2353 | { | ||
2354 | m_infoWin->setRead((100*pl + (ts >> 1))/ts); | ||
2355 | } | ||
2296 | m_infoWin->setDocSize(ds); | 2356 | m_infoWin->setDocSize(ds); |
2297 | m_infoWin->setDocLocation(dl); | 2357 | m_infoWin->setDocLocation(dl); |
2298 | m_infoWin->setDocRead((100*dl + (ds >> 1))/ds); | 2358 | if (dl > UINT_MAX/100) |
2359 | { | ||
2360 | unsigned long d1 = (ds+50)/100; | ||
2361 | m_infoWin->setDocRead((dl + (d1 >> 1))/d1); | ||
2362 | } | ||
2363 | else | ||
2364 | { | ||
2365 | m_infoWin->setDocRead((100*dl + (ds >> 1))/ds); | ||
2366 | } | ||
2299 | m_infoWin->setZoom(reader->m_fontControl.currentsize()*10); | 2367 | m_infoWin->setZoom(reader->m_fontControl.currentsize()*10); |
2300 | m_infoWin->setAbout(QString("\nApplication (c) Tim Wentford\n")+reader->about()); | 2368 | m_infoWin->setAbout(QString("\nApplication (c) Tim Wentford\n")+reader->about()); |
2301 | editorStack->raiseWidget( m_infoWin ); | 2369 | editorStack->raiseWidget( m_infoWin ); |
2302 | hidetoolbars(); | 2370 | hidetoolbars(); |
@@ -2741,9 +2809,9 @@ void QTReaderApp::search() | |||
2741 | findNext(); | 2809 | findNext(); |
2742 | } | 2810 | } |
2743 | #endif | 2811 | #endif |
2744 | 2812 | ||
2745 | void QTReaderApp::openFile( const QString &f ) | 2813 | void QTReaderApp::openFile( const QString &f, unsigned int loc ) |
2746 | { | 2814 | { |
2747 | // qDebug("File:%s", (const char*)f); | 2815 | // qDebug("File:%s", (const char*)f); |
2748 | // openFile(DocLnk(f)); | 2816 | // openFile(DocLnk(f)); |
2749 | //} | 2817 | //} |
@@ -2764,9 +2832,9 @@ void QTReaderApp::openFile( const QString &f ) | |||
2764 | if (!fm.exists()) return; | 2832 | if (!fm.exists()) return; |
2765 | } | 2833 | } |
2766 | #endif | 2834 | #endif |
2767 | clear(); | 2835 | clear(); |
2768 | reader->setText(fm.baseName(), fm.absFilePath()); | 2836 | reader->setText(fm.baseName(), fm.absFilePath(), loc); |
2769 | m_loadedconfig = readconfig(APPDIR "/configs", reader->m_string, false); | 2837 | m_loadedconfig = readconfig(APPDIR "/configs", reader->m_string, false); |
2770 | qDebug("Showing tools"); | 2838 | qDebug("Showing tools"); |
2771 | showEditTools(); | 2839 | showEditTools(); |
2772 | qDebug("Shown tools"); | 2840 | qDebug("Shown tools"); |
@@ -2805,9 +2873,9 @@ void QTReaderApp::handlekey(QKeyEvent* e) | |||
2805 | } | 2873 | } |
2806 | switch(e->key()) | 2874 | switch(e->key()) |
2807 | { | 2875 | { |
2808 | case Key_Escape: | 2876 | case Key_Escape: |
2809 | // qDebug("escape event"); | 2877 | qDebug("escape event"); |
2810 | if (m_disableesckey) | 2878 | if (m_disableesckey) |
2811 | { | 2879 | { |
2812 | m_disableesckey = false; | 2880 | m_disableesckey = false; |
2813 | } | 2881 | } |
@@ -2890,31 +2958,32 @@ void QTReaderApp::handlekey(QKeyEvent* e) | |||
2890 | } | 2958 | } |
2891 | ftime(&m_lastkeytime); | 2959 | ftime(&m_lastkeytime); |
2892 | } | 2960 | } |
2893 | 2961 | ||
2894 | #ifdef NEWFULLSCREEN | 2962 | #if defined(USEQPE) && defined(USENEWFULLSCREEN) |
2895 | void QTReaderApp::enableFullscreen() | 2963 | void QTReaderApp::focusInEvent(QFocusEvent *) |
2896 | { | ||
2897 | setFixedSize(qApp->desktop()->size()); | ||
2898 | showNormal(); | ||
2899 | reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); | ||
2900 | showFullScreen(); | ||
2901 | } | ||
2902 | |||
2903 | void QTReaderApp::resizeEvent(QResizeEvent *) | ||
2904 | { | 2964 | { |
2905 | if (m_fullscreen && (size() != qApp->desktop()->size())) | 2965 | if (m_usenewfullscreen && m_fullscreen && (editorStack->visibleWidget() == reader)) |
2906 | { | 2966 | { |
2907 | enableFullscreen(); | 2967 | m_usenewfullscreen = false; |
2968 | reader->bDoUpdates = false; | ||
2969 | showEditTools(); | ||
2970 | reader->bDoUpdates = true; | ||
2971 | reader->update(); | ||
2972 | m_usenewfullscreen = true; | ||
2908 | } | 2973 | } |
2909 | } | 2974 | } |
2910 | 2975 | ||
2911 | void QTReaderApp::focusInEvent(QFocusEvent*) | 2976 | void QTReaderApp::resizeEvent(QResizeEvent *) |
2912 | { | 2977 | { |
2913 | if (m_fullscreen) | 2978 | if (m_usenewfullscreen && m_fullscreen && (editorStack->visibleWidget() == reader)) |
2914 | { | 2979 | { |
2915 | enableFullscreen(); | 2980 | m_usenewfullscreen = false; |
2916 | raise(); | 2981 | reader->bDoUpdates = false; |
2982 | showEditTools(); | ||
2983 | reader->bDoUpdates = true; | ||
2984 | reader->update(); | ||
2985 | m_usenewfullscreen = true; | ||
2917 | } | 2986 | } |
2918 | } | 2987 | } |
2919 | #endif | 2988 | #endif |
2920 | 2989 | ||
@@ -2923,9 +2992,9 @@ void QTReaderApp::showEditTools() | |||
2923 | // if ( !doc ) | 2992 | // if ( !doc ) |
2924 | //close(); | 2993 | //close(); |
2925 | if (m_fullscreen) | 2994 | if (m_fullscreen) |
2926 | { | 2995 | { |
2927 | #ifdef USEQPE | 2996 | #if defined(USEQPE) |
2928 | if (menubar != NULL) menubar->hide(); | 2997 | if (menubar != NULL) menubar->hide(); |
2929 | #endif | 2998 | #endif |
2930 | if (fileBar != NULL) fileBar->hide(); | 2999 | if (fileBar != NULL) fileBar->hide(); |
2931 | if (viewBar != NULL) viewBar->hide(); | 3000 | if (viewBar != NULL) viewBar->hide(); |
@@ -2943,14 +3012,10 @@ void QTReaderApp::showEditTools() | |||
2943 | #endif | 3012 | #endif |
2944 | if (m_scrollbar != NULL) m_scrollbar->hide(); | 3013 | if (m_scrollbar != NULL) m_scrollbar->hide(); |
2945 | m_fontBar->hide(); | 3014 | m_fontBar->hide(); |
2946 | //showNormal(); | 3015 | //showNormal(); |
2947 | #ifdef NEWFULLSCREEN | ||
2948 | enableFullscreen(); | ||
2949 | #else | ||
2950 | showFullScreen(); | 3016 | showFullScreen(); |
2951 | #endif | 3017 | } |
2952 | } | ||
2953 | else | 3018 | else |
2954 | { | 3019 | { |
2955 | //qDebug("him"); | 3020 | //qDebug("him"); |
2956 | #ifdef USEQPE | 3021 | #ifdef USEQPE |
@@ -2969,9 +3034,9 @@ void QTReaderApp::showEditTools() | |||
2969 | } | 3034 | } |
2970 | } | 3035 | } |
2971 | if (!m_hidebars) | 3036 | if (!m_hidebars) |
2972 | { | 3037 | { |
2973 | #ifdef USEQPE | 3038 | #if defined(USEQPE) |
2974 | menubar->show(); | 3039 | menubar->show(); |
2975 | #endif | 3040 | #endif |
2976 | if (fileBar != NULL) fileBar->show(); | 3041 | if (fileBar != NULL) fileBar->show(); |
2977 | if (viewBar != NULL) viewBar->show(); | 3042 | if (viewBar != NULL) viewBar->show(); |
@@ -3003,9 +3068,9 @@ void QTReaderApp::showEditTools() | |||
3003 | if (m_fontVisible) m_fontBar->show(); | 3068 | if (m_fontVisible) m_fontBar->show(); |
3004 | //qDebug("sn"); | 3069 | //qDebug("sn"); |
3005 | showNormal(); | 3070 | showNormal(); |
3006 | //qDebug("sm"); | 3071 | //qDebug("sm"); |
3007 | #ifdef USEQPE | 3072 | #if defined(USEQPE) && !defined(SIMPAD) |
3008 | showMaximized(); | 3073 | showMaximized(); |
3009 | #endif | 3074 | #endif |
3010 | //setCentralWidget(reader); | 3075 | //setCentralWidget(reader); |
3011 | } | 3076 | } |
@@ -3016,9 +3081,9 @@ void QTReaderApp::showEditTools() | |||
3016 | editorStack->raiseWidget( reader ); | 3081 | editorStack->raiseWidget( reader ); |
3017 | // qDebug("sf"); | 3082 | // qDebug("sf"); |
3018 | reader->setFocus(); | 3083 | reader->setFocus(); |
3019 | // qDebug("ref"); | 3084 | // qDebug("ref"); |
3020 | reader->refresh(true); | 3085 | //reader->refresh(true); |
3021 | // qDebug("done"); | 3086 | // qDebug("done"); |
3022 | } | 3087 | } |
3023 | /* | 3088 | /* |
3024 | void QTReaderApp::save() | 3089 | void QTReaderApp::save() |
@@ -3173,33 +3238,43 @@ void QTReaderApp::do_delmark() | |||
3173 | if (!listbkmk(pBkmklist)) | 3238 | if (!listbkmk(pBkmklist)) |
3174 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); | 3239 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); |
3175 | } | 3240 | } |
3176 | 3241 | ||
3177 | bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab) | 3242 | bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab, bool presel) |
3178 | { | 3243 | { |
3179 | bkmkselector->clear(); | 3244 | bkmkselector->clear(); |
3180 | if (_lab.isEmpty()) | 3245 | if (_lab.isEmpty()) |
3181 | bkmkselector->setText("Cancel"); | 3246 | bkmkselector->setText("Cancel"); |
3182 | else | 3247 | else |
3183 | bkmkselector->setText(_lab); | 3248 | bkmkselector->setText(_lab); |
3184 | int cnt = 0; | 3249 | int cnt = 0; |
3250 | int slt = -1; | ||
3185 | if (plist != NULL) | 3251 | if (plist != NULL) |
3186 | { | 3252 | { |
3187 | for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++) | 3253 | for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++) |
3188 | { | 3254 | { |
3255 | if (presel) | ||
3256 | { | ||
3257 | Bkmk* p = i.pContent(); | ||
3258 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) | ||
3259 | { | ||
3260 | slt = cnt; | ||
3261 | } | ||
3262 | } | ||
3189 | #ifdef _UNICODE | 3263 | #ifdef _UNICODE |
3190 | // qDebug("Item:%s", (const char*)toQString(i->name())); | 3264 | // qDebug("Item:%s", (const char*)toQString(i->name())); |
3191 | bkmkselector->insertItem(toQString(i->name())); | 3265 | bkmkselector->insertItem(toQString(i->name()), cnt++); |
3192 | #else | 3266 | #else |
3193 | bkmkselector->insertItem(i->name()); | 3267 | bkmkselector->insertItem(i->name(), cnt++); |
3194 | #endif | 3268 | #endif |
3195 | cnt++; | 3269 | |
3196 | } | 3270 | } |
3197 | } | 3271 | } |
3198 | if (cnt > 0) | 3272 | if (cnt > 0) |
3199 | { | 3273 | { |
3200 | hidetoolbars(); | 3274 | hidetoolbars(); |
3201 | editorStack->raiseWidget( bkmkselector ); | 3275 | editorStack->raiseWidget( bkmkselector ); |
3276 | if (slt != -1) bkmkselector->setCurrentItem(slt); | ||
3202 | return true; | 3277 | return true; |
3203 | } | 3278 | } |
3204 | else | 3279 | else |
3205 | return false; | 3280 | return false; |
@@ -3237,32 +3312,33 @@ bool QTReaderApp::openfrombkmk(Bkmk* bk) | |||
3237 | //qDebug("fileinfo"); | 3312 | //qDebug("fileinfo"); |
3238 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) | 3313 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) |
3239 | { | 3314 | { |
3240 | //qDebug("Opening"); | 3315 | //qDebug("Opening"); |
3241 | openFile(fn); | ||
3242 | struct stat fnstat; | 3316 | struct stat fnstat; |
3243 | stat((const char *)reader->m_lastfile, &fnstat); | 3317 | stat((const char *)fn, &fnstat); |
3244 | 3318 | ||
3245 | if (CFiledata(bk->anno()).date() | 3319 | if (CFiledata(bk->anno()).date() |
3246 | != fnstat.st_mtime) | 3320 | != fnstat.st_mtime) |
3247 | { | 3321 | { |
3248 | CFiledata fd(bk->anno()); | 3322 | CFiledata fd(bk->anno()); |
3249 | fd.setdate(fnstat.st_mtime); | 3323 | fd.setdate(fnstat.st_mtime); |
3250 | bk->value(0); | 3324 | bk->value(0); |
3325 | reader->m_lastposn = 0; | ||
3326 | openFile(fn); | ||
3251 | } | 3327 | } |
3252 | else | 3328 | else |
3253 | { | 3329 | { |
3254 | unsigned short svlen = bk->filedatalen(); | 3330 | unsigned short svlen = bk->filedatalen(); |
3255 | unsigned char* svdata = bk->filedata(); | 3331 | unsigned char* svdata = bk->filedata(); |
3332 | openFile(fn, bk->value()); | ||
3256 | reader->putSaveData(svdata, svlen); | 3333 | reader->putSaveData(svdata, svlen); |
3257 | // setstate(svdata, svlen); | 3334 | // setstate(svdata, svlen); |
3258 | if (svlen != 0) | 3335 | if (svlen != 0) |
3259 | { | 3336 | { |
3260 | QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?"); | 3337 | QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?"); |
3261 | } | 3338 | } |
3262 | // qDebug("updating"); | 3339 | // qDebug("updating"); |
3263 | // showEditTools(); | 3340 | // showEditTools(); |
3264 | reader->locate(bk->value()); | ||
3265 | } | 3341 | } |
3266 | return true; | 3342 | return true; |
3267 | } | 3343 | } |
3268 | else | 3344 | else |
@@ -3365,9 +3441,9 @@ void QTReaderApp::gotobkmk(int ind) | |||
3365 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); | 3441 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); |
3366 | if (fin != NULL) | 3442 | if (fin != NULL) |
3367 | { | 3443 | { |
3368 | bool allok = false; | 3444 | bool allok = false; |
3369 | #ifdef OPIE | 3445 | #if defined(OPIE) && defined(OPIEFILEDIALOG) |
3370 | QString outfile = OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, QString::null, QString::null, MimeTypes(), 0, "OpieReader"); | 3446 | QString outfile = OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, QString::null, QString::null, MimeTypes(), 0, "OpieReader"); |
3371 | if (!outfile.isEmpty()) | 3447 | if (!outfile.isEmpty()) |
3372 | { | 3448 | { |
3373 | FILE* fout = fopen((const char *)outfile, "w"); | 3449 | FILE* fout = fopen((const char *)outfile, "w"); |
@@ -3702,11 +3778,12 @@ void QTReaderApp::do_autogen(const QString& regText) | |||
3702 | reader->setFocus(); | 3778 | reader->setFocus(); |
3703 | reader->jumpto(0); | 3779 | reader->jumpto(0); |
3704 | int lastpc = 0; | 3780 | int lastpc = 0; |
3705 | int i = 0; | 3781 | int i = 0; |
3782 | unsigned int llcn = reader->locate(); | ||
3706 | while (i >= 0) | 3783 | while (i >= 0) |
3707 | { | 3784 | { |
3708 | unsigned int lcn = reader->locate(); | 3785 | unsigned int lcn = llcn; |
3709 | int pc = (100*lcn)/ts; | 3786 | int pc = (100*lcn)/ts; |
3710 | if (pc != lastpc) | 3787 | if (pc != lastpc) |
3711 | { | 3788 | { |
3712 | pbar->setProgress(pc); | 3789 | pbar->setProgress(pc); |
@@ -3721,8 +3798,16 @@ void QTReaderApp::do_autogen(const QString& regText) | |||
3721 | #else | 3798 | #else |
3722 | if (re.match(buff.data()) != -1) | 3799 | if (re.match(buff.data()) != -1) |
3723 | #endif | 3800 | #endif |
3724 | pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); | 3801 | pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); |
3802 | /* | ||
3803 | llcn = reader->locate(); | ||
3804 | if ((i == 0) && (llcn+1 < ts)) | ||
3805 | { | ||
3806 | reader->jumpto(++llcn); | ||
3807 | i = 1; | ||
3808 | } | ||
3809 | */ | ||
3725 | } | 3810 | } |
3726 | pBkmklist->sort(); | 3811 | pBkmklist->sort(); |
3727 | pbar->setProgress(100); | 3812 | pbar->setProgress(100); |
3728 | qApp->processEvents(); | 3813 | qApp->processEvents(); |
@@ -4031,8 +4116,12 @@ void QTReaderApp::showAnnotation() | |||
4031 | void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, size_t posn2, const QString& line) | 4116 | void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, size_t posn2, const QString& line) |
4032 | { | 4117 | { |
4033 | //// qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd); | 4118 | //// qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd); |
4034 | 4119 | ||
4120 | if (m_doOutput && reader->checkoutput()) | ||
4121 | { | ||
4122 | reader->doOutput(wrd); | ||
4123 | } | ||
4035 | if (m_doClipboard) | 4124 | if (m_doClipboard) |
4036 | { | 4125 | { |
4037 | QClipboard* cb = QApplication::clipboard(); | 4126 | QClipboard* cb = QApplication::clipboard(); |
4038 | cb->setText(wrd); | 4127 | cb->setText(wrd); |
@@ -4115,9 +4204,9 @@ void QTReaderApp::doAction(QKeyEvent* e) | |||
4115 | case cesToggleBars: | 4204 | case cesToggleBars: |
4116 | m_hidebars = !m_hidebars; | 4205 | m_hidebars = !m_hidebars; |
4117 | if (m_hidebars) | 4206 | if (m_hidebars) |
4118 | { | 4207 | { |
4119 | #ifdef USEQPE | 4208 | #if defined(USEQPE) |
4120 | menubar->hide(); | 4209 | menubar->hide(); |
4121 | #endif | 4210 | #endif |
4122 | if (fileBar != NULL) fileBar->hide(); | 4211 | if (fileBar != NULL) fileBar->hide(); |
4123 | if (viewBar != NULL) viewBar->hide(); | 4212 | if (viewBar != NULL) viewBar->hide(); |
@@ -4126,9 +4215,9 @@ void QTReaderApp::doAction(QKeyEvent* e) | |||
4126 | mb->hide(); | 4215 | mb->hide(); |
4127 | } | 4216 | } |
4128 | else | 4217 | else |
4129 | { | 4218 | { |
4130 | #ifdef USEQPE | 4219 | #if defined(USEQPE) |
4131 | menubar->show(); | 4220 | menubar->show(); |
4132 | #endif | 4221 | #endif |
4133 | if (fileBar != NULL) fileBar->show(); | 4222 | if (fileBar != NULL) fileBar->show(); |
4134 | if (viewBar != NULL) viewBar->show(); | 4223 | if (viewBar != NULL) viewBar->show(); |
@@ -4339,8 +4428,9 @@ void QTReaderApp::do_saveconfig(const QString& _txt, bool full) | |||
4339 | #endif | 4428 | #endif |
4340 | 4429 | ||
4341 | 4430 | ||
4342 | config.writeEntry( "StripCr", reader->bstripcr ); | 4431 | config.writeEntry( "StripCr", reader->bstripcr ); |
4432 | config.writeEntry( "NoInlineTables", reader->bNoInlineTables ); | ||
4343 | config.writeEntry( "AutoFmt", reader->bautofmt ); | 4433 | config.writeEntry( "AutoFmt", reader->bautofmt ); |
4344 | config.writeEntry( "TextFmt", reader->btextfmt ); | 4434 | config.writeEntry( "TextFmt", reader->btextfmt ); |
4345 | config.writeEntry( "StripHtml", reader->bstriphtml ); | 4435 | config.writeEntry( "StripHtml", reader->bstriphtml ); |
4346 | config.writeEntry( "Dehyphen", reader->bdehyphen ); | 4436 | config.writeEntry( "Dehyphen", reader->bdehyphen ); |
@@ -4364,8 +4454,9 @@ void QTReaderApp::do_saveconfig(const QString& _txt, bool full) | |||
4364 | config.writeEntry("FloatDialogs", m_bFloatingDialog); | 4454 | config.writeEntry("FloatDialogs", m_bFloatingDialog); |
4365 | reader->m_lastposn = reader->pagelocate(); | 4455 | reader->m_lastposn = reader->pagelocate(); |
4366 | config.writeEntry( "LastFile", reader->m_lastfile ); | 4456 | config.writeEntry( "LastFile", reader->m_lastfile ); |
4367 | config.writeEntry( "LastPosn", (int)(reader->pagelocate()) ); | 4457 | config.writeEntry( "LastPosn", (int)(reader->pagelocate()) ); |
4458 | config.writeEntry( "OutputCodec", reader->m_outputName); | ||
4368 | } | 4459 | } |
4369 | config.writeEntry( "PageMode", reader->m_bpagemode ); | 4460 | config.writeEntry( "PageMode", reader->m_bpagemode ); |
4370 | config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced ); | 4461 | config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced ); |
4371 | config.writeEntry( "SwapMouse", reader->m_swapmouse); | 4462 | config.writeEntry( "SwapMouse", reader->m_swapmouse); |
@@ -4395,8 +4486,9 @@ void QTReaderApp::do_saveconfig(const QString& _txt, bool full) | |||
4395 | config.writeEntry( "TwoTouch", m_twoTouch ); | 4486 | config.writeEntry( "TwoTouch", m_twoTouch ); |
4396 | config.writeEntry( "Annotation", m_doAnnotation); | 4487 | config.writeEntry( "Annotation", m_doAnnotation); |
4397 | config.writeEntry( "Dictionary", m_doDictionary); | 4488 | config.writeEntry( "Dictionary", m_doDictionary); |
4398 | config.writeEntry( "Clipboard", m_doClipboard); | 4489 | config.writeEntry( "Clipboard", m_doClipboard); |
4490 | config.writeEntry( "OutputTgt", m_doOutput); | ||
4399 | /* | 4491 | /* |
4400 | config.writeEntry( "SpaceTarget", m_spaceTarget); | 4492 | config.writeEntry( "SpaceTarget", m_spaceTarget); |
4401 | config.writeEntry( "EscapeTarget", m_escapeTarget); | 4493 | config.writeEntry( "EscapeTarget", m_escapeTarget); |
4402 | config.writeEntry( "ReturnTarget", m_returnTarget); | 4494 | config.writeEntry( "ReturnTarget", m_returnTarget); |
@@ -4409,14 +4501,17 @@ void QTReaderApp::do_saveconfig(const QString& _txt, bool full) | |||
4409 | config.writeEntry("UpScroll", m_upScroll); | 4501 | config.writeEntry("UpScroll", m_upScroll); |
4410 | config.writeEntry("DownScroll", m_downScroll); | 4502 | config.writeEntry("DownScroll", m_downScroll); |
4411 | */ | 4503 | */ |
4412 | config.writeEntry( "Repalm", reader->brepalm ); | 4504 | config.writeEntry( "Repalm", reader->brepalm ); |
4505 | config.writeEntry( "UnderlineLink", reader->bunderlineLink ); | ||
4413 | config.writeEntry( "HideScrollBar", m_scrollishidden ); | 4506 | config.writeEntry( "HideScrollBar", m_scrollishidden ); |
4507 | config.writeEntry( "HideToolBar", m_hidebars ); | ||
4414 | config.writeEntry( "Kern", reader->bkern ); | 4508 | config.writeEntry( "Kern", reader->bkern ); |
4415 | config.writeEntry( "Remap", reader->bremap ); | 4509 | config.writeEntry( "Remap", reader->bremap ); |
4416 | config.writeEntry( "Peanut", reader->bpeanut ); | 4510 | config.writeEntry( "Peanut", reader->bpeanut ); |
4417 | config.writeEntry( "MakeBold", reader->bmakebold ); | 4511 | config.writeEntry( "MakeBold", reader->bmakebold ); |
4418 | config.writeEntry( "Continuous", reader->m_continuousDocument ); | 4512 | config.writeEntry( "Continuous", reader->m_continuousDocument ); |
4513 | config.writeEntry( "DoubleBuffer", reader->m_doubleBuffered); | ||
4419 | config.writeEntry( "FullJust", reader->bfulljust ); | 4514 | config.writeEntry( "FullJust", reader->bfulljust ); |
4420 | // config.writeEntry( "Negative", reader->bNegative ); | 4515 | // config.writeEntry( "Negative", reader->bNegative ); |
4421 | config.writeEntry( "Inverse", reader->bInverse ); | 4516 | config.writeEntry( "Inverse", reader->bInverse ); |
4422 | config.writeEntry( "FixGraphics", reader->m_fontControl.FixGraphics()); | 4517 | config.writeEntry( "FixGraphics", reader->m_fontControl.FixGraphics()); |
@@ -4518,8 +4613,9 @@ bool QTReaderApp::readconfig(const QString& dirname, const QString& _txt, bool f | |||
4518 | } | 4613 | } |
4519 | config.setGroup( "View" ); | 4614 | config.setGroup( "View" ); |
4520 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", m_bFloatingDialog); | 4615 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", m_bFloatingDialog); |
4521 | reader->bstripcr = config.readBoolEntry( "StripCr", reader->bstripcr ); | 4616 | reader->bstripcr = config.readBoolEntry( "StripCr", reader->bstripcr ); |
4617 | reader->bNoInlineTables = config.readBoolEntry( "NoInlineTables", reader->bNoInlineTables ); | ||
4522 | reader->bfulljust = config.readBoolEntry( "FullJust", reader->bfulljust ); | 4618 | reader->bfulljust = config.readBoolEntry( "FullJust", reader->bfulljust ); |
4523 | reader->bInverse = config.readBoolEntry( "Inverse", reader->bInverse ); | 4619 | reader->bInverse = config.readBoolEntry( "Inverse", reader->bInverse ); |
4524 | // reader->bNegative = config.readBoolEntry( "Negative", false ); | 4620 | // reader->bNegative = config.readBoolEntry( "Negative", false ); |
4525 | reader->m_fontControl.FixGraphics(config.readBoolEntry( "FixGraphics", reader->m_fontControl.FixGraphics() )); | 4621 | reader->m_fontControl.FixGraphics(config.readBoolEntry( "FixGraphics", reader->m_fontControl.FixGraphics() )); |
@@ -4573,13 +4669,16 @@ bool QTReaderApp::readconfig(const QString& dirname, const QString& _txt, bool f | |||
4573 | reader->m_absbottommargin = config.readNumEntry( "Bottom Margin", reader->m_absbottommargin ); | 4669 | reader->m_absbottommargin = config.readNumEntry( "Bottom Margin", reader->m_absbottommargin ); |
4574 | reader->m_absleft_border = config.readNumEntry( "Left Margin", reader->m_absleft_border ); | 4670 | reader->m_absleft_border = config.readNumEntry( "Left Margin", reader->m_absleft_border ); |
4575 | reader->m_absright_border = config.readNumEntry( "Right Margin", reader->m_absright_border ); | 4671 | reader->m_absright_border = config.readNumEntry( "Right Margin", reader->m_absright_border ); |
4576 | m_scrollishidden = config.readBoolEntry( "HideScrollBar", m_scrollishidden ); | 4672 | m_scrollishidden = config.readBoolEntry( "HideScrollBar", m_scrollishidden ); |
4673 | m_hidebars = config.readBoolEntry( "HideToolBar", m_hidebars ); | ||
4577 | reader->brepalm = config.readBoolEntry( "Repalm", reader->brepalm ); | 4674 | reader->brepalm = config.readBoolEntry( "Repalm", reader->brepalm ); |
4675 | reader->bunderlineLink = config.readBoolEntry( "UnderlineLink", reader->bunderlineLink ); | ||
4578 | reader->bkern = config.readBoolEntry( "Kern", reader->bkern ); | 4676 | reader->bkern = config.readBoolEntry( "Kern", reader->bkern ); |
4579 | reader->bremap = config.readBoolEntry( "Remap", reader->bremap ); | 4677 | reader->bremap = config.readBoolEntry( "Remap", reader->bremap ); |
4580 | reader->bmakebold = config.readBoolEntry( "MakeBold", reader->bmakebold ); | 4678 | reader->bmakebold = config.readBoolEntry( "MakeBold", reader->bmakebold ); |
4581 | reader->setContinuous(config.readBoolEntry( "Continuous", reader->m_continuousDocument )); | 4679 | reader->setContinuous(config.readBoolEntry( "Continuous", reader->m_continuousDocument )); |
4680 | reader->setDoubleBuffer(config.readBoolEntry("DoubleBuffer", reader->m_doubleBuffered)); | ||
4582 | m_targetapp = config.readEntry( "TargetApp", m_targetapp ); | 4681 | m_targetapp = config.readEntry( "TargetApp", m_targetapp ); |
4583 | m_targetmsg = config.readEntry( "TargetMsg", m_targetmsg ); | 4682 | m_targetmsg = config.readEntry( "TargetMsg", m_targetmsg ); |
4584 | #ifdef _SCROLLPIPE | 4683 | #ifdef _SCROLLPIPE |
4585 | reader->m_pipetarget = config.readEntry( "PipeTarget", reader->m_pipetarget ); | 4684 | reader->m_pipetarget = config.readEntry( "PipeTarget", reader->m_pipetarget ); |
@@ -4588,14 +4687,17 @@ bool QTReaderApp::readconfig(const QString& dirname, const QString& _txt, bool f | |||
4588 | m_twoTouch = config.readBoolEntry( "TwoTouch", m_twoTouch); | 4687 | m_twoTouch = config.readBoolEntry( "TwoTouch", m_twoTouch); |
4589 | m_doAnnotation = config.readBoolEntry( "Annotation", m_doAnnotation); | 4688 | m_doAnnotation = config.readBoolEntry( "Annotation", m_doAnnotation); |
4590 | m_doDictionary = config.readBoolEntry( "Dictionary", m_doDictionary); | 4689 | m_doDictionary = config.readBoolEntry( "Dictionary", m_doDictionary); |
4591 | m_doClipboard = config.readBoolEntry( "Clipboard", m_doClipboard); | 4690 | m_doClipboard = config.readBoolEntry( "Clipboard", m_doClipboard); |
4691 | m_doOutput = config.readBoolEntry( "OutputTgt", m_doOutput); | ||
4592 | #ifdef USEQPE | 4692 | #ifdef USEQPE |
4593 | m_grabkeyboard = config.readBoolEntry( "GrabKeyboard", m_grabkeyboard); | 4693 | m_grabkeyboard = config.readBoolEntry( "GrabKeyboard", m_grabkeyboard); |
4594 | #endif | 4694 | #endif |
4595 | m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", m_propogatefontchange); | 4695 | m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", m_propogatefontchange); |
4596 | reader->setBaseSize(config.readNumEntry( "Basesize", reader->getBaseSize() )); | 4696 | reader->setBaseSize(config.readNumEntry( "Basesize", reader->getBaseSize() )); |
4597 | reader->setTwoTouch(m_twoTouch); | 4697 | reader->setTwoTouch(m_twoTouch); |
4698 | |||
4699 | reader->m_outputName = config.readEntry( "OutputCodec", reader->m_outputName); | ||
4598 | 4700 | ||
4599 | m_touch_action->setOn(m_twoTouch); | 4701 | m_touch_action->setOn(m_twoTouch); |
4600 | m_setmono_action->setOn(reader->m_bMonoSpaced); | 4702 | m_setmono_action->setOn(reader->m_bMonoSpaced); |
4601 | setfontHelper(reader->m_fontname); | 4703 | setfontHelper(reader->m_fontname); |
@@ -4636,10 +4738,9 @@ bool QTReaderApp::PopulateConfig(const char* tgtdir, bool usedirs) | |||
4636 | QFileInfo *fi; // pointer for traversing | 4738 | QFileInfo *fi; // pointer for traversing |
4637 | 4739 | ||
4638 | while ( (fi=it.current()) ) { // for each file... | 4740 | while ( (fi=it.current()) ) { // for each file... |
4639 | 4741 | ||
4640 | bkmkselector->insertItem(fi->fileName()); | 4742 | bkmkselector->insertItem(fi->fileName(), cnt++); |
4641 | cnt++; | ||
4642 | 4743 | ||
4643 | //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); | 4744 | //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); |
4644 | ++it; // goto next list element | 4745 | ++it; // goto next list element |
4645 | } | 4746 | } |
@@ -4662,10 +4763,9 @@ bool QTReaderApp::PopulateConfig(const char* tgtdir, bool usedirs) | |||
4662 | if (de == NULL) break; | 4763 | if (de == NULL) break; |
4663 | 4764 | ||
4664 | if (lstat((const char *)Global::applicationFileName(finaldir,de->d_name),&buf) == 0 && ((usedirs && S_ISDIR(buf.st_mode)) || (!usedirs && S_ISREG(buf.st_mode)))) | 4765 | if (lstat((const char *)Global::applicationFileName(finaldir,de->d_name),&buf) == 0 && ((usedirs && S_ISDIR(buf.st_mode)) || (!usedirs && S_ISREG(buf.st_mode)))) |
4665 | { | 4766 | { |
4666 | bkmkselector->insertItem(de->d_name); | 4767 | bkmkselector->insertItem(de->d_name, cnt++); |
4667 | cnt++; | ||
4668 | } | 4768 | } |
4669 | } | 4769 | } |
4670 | delete [] finaldir; | 4770 | delete [] finaldir; |
4671 | closedir(d); | 4771 | closedir(d); |
@@ -4734,8 +4834,10 @@ void QTReaderApp::OnURLSelected(const QString& href, const size_t tgt) | |||
4734 | else | 4834 | else |
4735 | { | 4835 | { |
4736 | qDebug("No type"); | 4836 | qDebug("No type"); |
4737 | } | 4837 | } |
4838 | QString msg = "External URL\n" + href; | ||
4839 | QMessageBox::information(this, PROGNAME, msg); | ||
4738 | #else | 4840 | #else |
4739 | if (href.isEmpty()) | 4841 | if (href.isEmpty()) |
4740 | { | 4842 | { |
4741 | QMessageBox::information(this, PROGNAME, "No URL information supplied"); | 4843 | QMessageBox::information(this, PROGNAME, "No URL information supplied"); |
@@ -4900,9 +5002,9 @@ void QTReaderApp::forceopen(const QString& filename) | |||
4900 | QFileInfo fi(reader->m_lastfile); | 5002 | QFileInfo fi(reader->m_lastfile); |
4901 | fi = QFileInfo(filename); | 5003 | fi = QFileInfo(filename); |
4902 | QString flnm = fi.absFilePath(); | 5004 | QString flnm = fi.absFilePath(); |
4903 | */ | 5005 | */ |
4904 | if (!filename.isEmpty()) | 5006 | if (!filename.isEmpty() && QFileInfo(filename).exists()) |
4905 | { | 5007 | { |
4906 | updatefileinfo(); | 5008 | updatefileinfo(); |
4907 | if (pBkmklist != NULL) | 5009 | if (pBkmklist != NULL) |
4908 | { | 5010 | { |
@@ -4917,8 +5019,12 @@ void QTReaderApp::forceopen(const QString& filename) | |||
4917 | reader->disableAutoscroll(); | 5019 | reader->disableAutoscroll(); |
4918 | openFile(filename); | 5020 | openFile(filename); |
4919 | reader->setFocus(); | 5021 | reader->setFocus(); |
4920 | } | 5022 | } |
5023 | else | ||
5024 | { | ||
5025 | OnURLSelected(filename, 0); | ||
5026 | } | ||
4921 | } | 5027 | } |
4922 | 5028 | ||
4923 | void QTReaderApp::actionscroll(int v) | 5029 | void QTReaderApp::actionscroll(int v) |
4924 | { | 5030 | { |