author | pohly <pohly> | 2005-05-05 14:39:33 (UTC) |
---|---|---|
committer | pohly <pohly> | 2005-05-05 14:39:33 (UTC) |
commit | 39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91 (patch) (side-by-side diff) | |
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 @@ -12,16 +12,17 @@ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ + #include <qregexp.h> #include <qclipboard.h> #include <qwidgetstack.h> #ifdef USEQPE #include <qpe/qpemenubar.h> #include <qpe/qpetoolbar.h> #endif #include <qmenubar.h> @@ -61,39 +62,44 @@ #include "ToolbarPrefs.h" #include "Prefs.h" #include "CAnnoEdit.h" #include "QFloatBar.h" #include "FixedFont.h" #include "URLDialog.h" #include "util.h" #include <qfontdatabase.h> + #ifdef USEQPE #include <qpe/resource.h> #ifdef OPIE -//#include <qpe/applnk.h> +#if defined(OPIEFILEDIALOG) +#include <qpe/applnk.h> #include <opie2/ofiledialog.h> using namespace Opie::Ui; #else #include "fileBrowser.h" #endif #else +#include "fileBrowser.h" +#endif +#else #include "qfiledialog.h" #endif #include "QTReaderApp.h" #include "CDrawBuffer.h" #include "Filedata.h" #include "names.h" #include "CEncoding_tables.h" #include "CloseDialog.h" #include "ButtonPrefs.h" -bool CheckVersion(int&, int&, char&); +bool CheckVersion(int&, int&, char&, QWidget*); #ifdef _WINDOWS #define PICDIR "c:\\uqtreader\\pics\\" #else #ifdef USEQPE #define USEMSGS #define PICDIR "opie-reader/" #else @@ -148,21 +154,19 @@ void QTReaderApp::listBkmkFiles() d.setFilter( QDir::Files | QDir::NoSymLinks ); // d.setSorting( QDir::Size | QDir::Reversed ); const QFileInfoList *list = d.entryInfoList(); QFileInfoListIterator it( *list ); // create list iterator QFileInfo *fi; // pointer for traversing - while ( (fi=it.current()) ) { // for each file... - bkmkselector->insertItem(fi->fileName()); - cnt++; + bkmkselector->insertItem(fi->fileName(), cnt++); //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); ++it; // goto next list element } #else /* USEQPE */ int cnt = 0; DIR *d; @@ -172,18 +176,17 @@ void QTReaderApp::listBkmkFiles() { struct dirent* de; struct stat buf; de = readdir(d); if (de == NULL) break; if (lstat((const char *)Global::applicationFileName(APPDIR,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) { - bkmkselector->insertItem(de->d_name); - cnt++; + bkmkselector->insertItem(de->d_name, cnt++); } } closedir(d); #endif if (cnt > 0) { //tjw menu->hide(); @@ -197,17 +200,17 @@ void QTReaderApp::listBkmkFiles() QMessageBox::information(this, PROGNAME, "No bookmark files"); } void QTReaderApp::hidetoolbars() { if (m_scrollbar != NULL) m_scrollbar->hide(); if (m_prog != NULL) m_prog->hide(); -#ifdef USEQPE +#if defined(USEQPE) menubar->hide(); #endif if (m_scrollbar != NULL) m_scrollbar->hide(); if (fileBar != NULL) fileBar->hide(); if (viewBar != NULL) viewBar->hide(); if (navBar != NULL) navBar->hide(); @@ -328,24 +331,24 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) m_qtscroll = config.readNumEntry("QTScrollBar", false); m_localscroll = config.readNumEntry("LocalScrollBar", false); // fileBar = new QToolBar("File", this); // QToolBar* viewBar = new QToolBar("File", this); // QToolBar* navBar = new QToolBar("File", this); // QToolBar* markBar = new QToolBar("File", this); -#ifdef USEQPE +#if defined(USEQPE) menubar = new QToolBar("Menus", this, m_tbposition); mb = new QPEMenuBar( menubar ); #else mb = new QMenuBar( this ); #endif -#ifdef USEQPE +#if defined(USEQPE) QPopupMenu* tmp = new QPopupMenu(mb); mb->insertItem( geticon( "AppsIcon" ), tmp ); #else QMenuBar* tmp = mb; #endif QPopupMenu *file = new QPopupMenu( mb ); tmp->insertItem( tr( "File" ), file ); @@ -431,16 +434,19 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) #ifdef USEQPE ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); #endif // qDebug("Reading config"); // Config config( APPDIR ); config.setGroup( "View" ); +#if defined(USEQPE) && defined(USENEWFULLSCREEN) + m_usenewfullscreen = config.readBoolEntry("NewFullScreen", false); +#endif m_debounce = config.readNumEntry("Debounce", 0); m_buttonprefs->Debounce(m_debounce); #ifdef USEQPE m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); #else m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true); #endif reader->setStripCR(config.readBoolEntry( "StripCr", true )); @@ -451,31 +457,34 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) */ reader->bInverse = config.readBoolEntry("Inverse", false); reader->m_fontControl.FixGraphics(config.readBoolEntry( "FixGraphics", false )); reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 )); reader->setlead(config.readNumEntry( "ExtraLead", 0 )); reader->btextfmt = config.readBoolEntry( "TextFmt", false ); reader->bautofmt = config.readBoolEntry( "AutoFmt", true ); reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); + reader->bNoInlineTables = config.readBoolEntry( "NoInlineTables", false ); reader->bpeanut = config.readBoolEntry( "Peanut", false ); reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); reader->bdepluck = config.readBoolEntry( "Depluck", false ); reader->bdejpluck = config.readBoolEntry( "Dejpluck", false ); reader->bonespace = config.readBoolEntry( "OneSpace", false ); reader->bunindent = config.readBoolEntry( "Unindent", false ); reader->brepara = config.readBoolEntry( "Repara", false ); reader->m_reparastring = config.readEntry( "ReparaString", "\\n{[\\n \\t]}"); m_bgtype = (bground)config.readNumEntry( "BackgroundType" , 0 ); m_themename = config.readEntry("Theme", QString::null ); reader->bdblspce = config.readBoolEntry( "DoubleSpace", false ); reader->bindenter = config.readNumEntry( "Indent", 0 ); reader->m_textsize = config.readNumEntry( "FontSize", 12 ); reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); reader->m_scrollstep = config.readNumEntry( "ScrollStep", 1); + reader->m_outputName = config.readEntry( "OutputCodec", ""); + reader->m_lastfile = config.readEntry( "LastFile", QString::null ); reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false); reader->m_rotated = config.readBoolEntry( "IsRotated", false ); reader->m_scrolltype = config.readNumEntry( "ScrollType", 0 ); m_statusstring = config.readEntry("StatusContent", "%P%% Doc:%d/%D %p%% %z%%"); @@ -495,32 +504,36 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) reader->m_charpc = config.readNumEntry( "CharSpacing", 100 ); reader->m_overlap = config.readNumEntry( "Overlap", 0 ); reader->m_abstopmargin = config.readNumEntry( "Top Margin", 100 ); reader->m_absbottommargin = config.readNumEntry( "Bottom Margin", 100 ); reader->m_absleft_border = config.readNumEntry( "Left Margin", 100 ); reader->m_absright_border = config.readNumEntry( "Right Margin", 100 ); m_scrollishidden = config.readBoolEntry( "HideScrollBar", false ); + m_hidebars = config.readBoolEntry( "HideToolBar", false ); reader->brepalm = config.readBoolEntry( "Repalm", false ); + reader->bunderlineLink = config.readBoolEntry( "UnderlineLink", true ); reader->bkern = config.readBoolEntry( "Kern", false ); reader->bremap = config.readBoolEntry( "Remap", true ); reader->bmakebold = config.readBoolEntry( "MakeBold", false ); reader->setContinuous(config.readBoolEntry( "Continuous", true )); + reader->setDoubleBuffer(config.readBoolEntry("DoubleBuffer", true)); m_targetapp = config.readEntry( "TargetApp", QString::null ); m_targetmsg = config.readEntry( "TargetMsg", QString::null ); #ifdef _SCROLLPIPE reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null ); reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true ); #endif m_twoTouch = config.readBoolEntry( "TwoTouch", false); m_doAnnotation = config.readBoolEntry( "Annotation", false); m_doDictionary = config.readBoolEntry( "Dictionary", false); m_doClipboard = config.readBoolEntry( "Clipboard", false); + m_doOutput = config.readBoolEntry( "OutputTgt", false); /* m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll); m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone); m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen); m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut); m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn); m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp); m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown); @@ -837,16 +850,28 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) connect( m_endBlock_action, SIGNAL( activated() ), this, SLOT( editCopy() ) ); m_endBlock_action->addTo( marks ); m_bkmkAvail = NULL; setToolBarsMovable(m_tbmove); addtoolbars(&config); + if (m_hidebars) + { +#if defined(USEQPE) + menubar->hide(); +#endif + if (fileBar != NULL) fileBar->hide(); + if (viewBar != NULL) viewBar->hide(); + if (navBar != NULL) navBar->hide(); + if (markBar != NULL) markBar->hide(); + mb->hide(); + } + pbar = new QProgressBar(this); pbar->hide(); searchBar = new QFloatBar( "Search", this, QMainWindow::Top, TRUE ); searchBar->setHorizontalStretchable( TRUE ); @@ -967,16 +992,17 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) // qDebug("Inited"); // m_buttonAction[m_spaceTarget]->setOn(true); // qDebug("fonting"); do_setfont(reader->m_fontname); // qDebug("fonted"); QFont progfont(reader->m_fontname, reader->m_fontControl.getsize(0)); m_prog->setFont( progfont ); if (m_statusishidden) m_prog->hide(); + showEditTools(); if (!reader->m_lastfile.isEmpty()) { // qDebug("doclnk"); // doc = new DocLnk(reader->m_lastfile); // qDebug("doclnk done"); if (pOpenlist != NULL) { @@ -1027,23 +1053,23 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) if (m_scrollbar == NULL || m_scrollbar->isHidden()) { reader->m_scrollpos = m_localscroll; } else { reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; } - reader->bDoUpdates = true; - reader->update(); + // reader->bDoUpdates = true; + // reader->update(); config.setGroup("Version"); int major = config.readNumEntry("Major", 0); int bkmktype = config.readNumEntry("BkmkType", 0); char minor = config.readNumEntry("Minor", 0); - if (CheckVersion(major, bkmktype, minor)) + if (CheckVersion(major, bkmktype, minor, this)) { config.writeEntry("Major", major); config.writeEntry("BkmkType", bkmktype); config.writeEntry("Minor", (int)minor); } // qDebug("finished update"); if (kmap.isEmpty()) { @@ -1060,17 +1086,17 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) } void QTReaderApp::addtoolbars(Config* config) { config->setGroup("Toolbar"); if (fileBar != NULL) { -#ifdef USEQPE +#if defined(USEQPE) if (fileBar != menubar) { fileBar->clear(); } else { m_preferences_action->removeFrom( filebar() ); m_open_action->removeFrom( filebar() ); @@ -1088,17 +1114,17 @@ void QTReaderApp::addtoolbars(Config* config) addfilebar(config, "Open", m_open_action); addfilebar(config, "Close", m_close_action); addfilebar(config, "Info", m_info_action); addfilebar(config, "Two/One Touch", m_touch_action); addfilebar(config, "Find", m_find_action); if (navBar != NULL) { -#ifdef USEQPE +#if defined(USEQPE) if ((navBar == fileBar) && (fileBar == menubar)) #else if (navBar == fileBar) #endif { m_scrollButton->removeFrom( navbar() ); m_start_action->removeFrom( navbar() ); m_end_action->removeFrom( navbar() ); @@ -1127,17 +1153,17 @@ void QTReaderApp::addtoolbars(Config* config) addnavbar(config, "Page Down", m_pagedn_action); addnavbar(config, "Back", m_back_action); addnavbar(config, "Home", m_home_action); addnavbar(config, "Forward", m_forward_action); if (viewBar != NULL) { -#ifdef USEQPE +#if defined(USEQPE) if ((viewBar == fileBar) && (fileBar == menubar)) #else if (viewBar == fileBar) #endif { m_actFullscreen->removeFrom( filebar() ); m_rotate_action->removeFrom( viewbar() ); m_inverse_action->removeFrom( viewbar() ); @@ -1159,17 +1185,17 @@ void QTReaderApp::addtoolbars(Config* config) addviewbar(config, "Zoom In", m_zoomin_action); addviewbar(config, "Zoom Out", m_zoomout_action); addviewbar(config, "Set Font", m_setfont_action); addviewbar(config, "Encoding Select", m_setenc_action); addviewbar(config, "Ideogram Mode", m_setmono_action); if (markBar != NULL) { -#ifdef USEQPE +#if defined(USEQPE) if ((markBar == fileBar) && (fileBar == menubar)) #else if (markBar == fileBar) #endif { m_mark_action->removeFrom( markbar() ); m_annotate_action->removeFrom( markbar()); m_goto_action->removeFrom( markbar() ); @@ -1228,17 +1254,17 @@ bool QTReaderApp::checkbar(Config* _config, const QString& key) QToolBar* QTReaderApp::filebar() { if (fileBar == NULL) { switch (m_tbpol) { -#ifdef USEQPE +#if defined(USEQPE) case cesSingle: // qDebug("Setting filebar to menubar"); fileBar = menubar; break; #endif default: qDebug("Incorrect toolbar policy set"); case cesMenuTool: @@ -1712,35 +1738,33 @@ void QTReaderApp::setrotated(bool sfs) m_scrollbar->setOrientation(Qt::Horizontal); connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineUp()) ); connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineDown()) ); connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopageup()) ); connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopagedn()) ); connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); } // reader->repaint(0, reader->m_left_border, reader->width(), reader->height()-2*reader->m_border); - reader->repaint(); } else { m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::RightToLeft : QBoxLayout::LeftToRight ); if (m_scrollbar != NULL) { scrollbar->disconnect(); m_scrollbar->setOrientation(Qt::Vertical); connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineDown()) ); connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineUp()) ); connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopagedn()) ); connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopageup()) ); connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); } // reader->repaint(reader->m_border, 0, reader->width()-2*reader->m_border, reader->height()); - reader->repaint(); } - // reader->update(); + reader->refresh(); } void QTReaderApp::setgrab(bool sfs) { #ifdef USEQPE m_grabkeyboard = sfs; if (m_grabkeyboard) { @@ -1923,17 +1947,17 @@ void QTReaderApp::fileOpen2() /* editorStack->raiseWidget( fileSelector ); fileSelector->reread(); */ bool usebrowser = true; if (pOpenlist != NULL) { m_nBkmkAction = cOpenFile; - if (listbkmk(pOpenlist, "Browse")) usebrowser = false; + if (listbkmk(pOpenlist, "Browse", true)) usebrowser = false; } if (usebrowser) { QString fn = usefilebrowser(); // qApp->processEvents(); if (!fn.isEmpty() && QFileInfo(fn).isFile()) { openFile(fn); @@ -1946,17 +1970,17 @@ void QTReaderApp::fileOpen2() QString QTReaderApp::usefilebrowser() { #ifndef USEQPE QString s( QFileDialog::getOpenFileName( reader->m_lastfile, QString::null, this ) ); return s; #else QString fn; -#ifdef OPIE +#if defined(OPIE) && defined(OPIEFILEDIALOG) QMap<QString, QStringList> mimeTypes; QStringList etypes; etypes << "etext/*"; mimeTypes.insert( tr("eText"), etypes ); QStringList types; types << "text/*"; mimeTypes.insert( tr("Text"), types ); mimeTypes.insert( tr("All"), "*/*" ); @@ -1998,28 +2022,30 @@ void QTReaderApp::showbuttonprefs() void QTReaderApp::showprefs() { CPrefs* prefwin = new CPrefs(reader->width(), !m_bFloatingDialog, this); // prefwin->Debounce(m_debounce); prefwin->bgtype(m_bgtype); prefwin->repalm(reader->brepalm); + prefwin->UnderlineLink(reader->bunderlineLink); prefwin->kern(reader->bkern); prefwin->hyphenate(reader->hyphenate); // prefwin->customhyphen(reader->buffdoc.getCustomHyphen()); prefwin->scrolltype(reader->m_scrolltype); prefwin->scrollstep(reader->m_scrollstep); prefwin->scrollcolor(m_scrollcolor); prefwin->minibarcol(m_scrollbarcolor); prefwin->foreground(m_foreground); prefwin->background(m_background); prefwin->twotouch(m_twoTouch); prefwin->propfontchange(m_propogatefontchange); prefwin->StripCR(reader->bstripcr); + prefwin->InlineTables(!reader->bNoInlineTables); prefwin->Dehyphen(reader->bdehyphen); prefwin->SingleSpace(reader->bonespace); prefwin->Unindent(reader->bunindent); prefwin->Reparagraph(reader->brepara); prefwin->DoubleSpace(reader->bdblspce); prefwin->Remap(reader->bremap); prefwin->Embolden(reader->bmakebold); prefwin->FullJustify(reader->bfulljust); @@ -2051,49 +2077,55 @@ void QTReaderApp::showprefs() } else { prefwin->Markup(1); } prefwin->Depluck(reader->bdepluck); prefwin->Dejpluck(reader->bdejpluck); prefwin->Continuous(reader->m_continuousDocument); + prefwin->DoubleBuffer(reader->m_doubleBuffered); prefwin->dictApplication(m_targetapp); prefwin->dictMessage(m_targetmsg); /* prefwin->leftScroll(m_leftScroll); prefwin->rightScroll(m_rightScroll); prefwin->upScroll(m_upScroll); prefwin->downScroll(m_downScroll); */ prefwin->miscannotation(m_doAnnotation); prefwin->miscdictionary(m_doDictionary); prefwin->miscclipboard(m_doClipboard); + prefwin->miscoutput(m_doOutput); prefwin->SwapMouse(reader->m_swapmouse); prefwin->Font(reader->m_fontname); prefwin->gfxsize(reader->getBaseSize()); prefwin->pageoverlap(reader->m_overlap); prefwin->ideogram(reader->m_bMonoSpaced); prefwin->encoding(reader->m_encd); prefwin->ideogramwidth(reader->m_charpc); + prefwin->outcodec(reader->m_outputName); + if (prefwin->exec()) { // m_debounce = prefwin->Debounce(); reader->brepalm = prefwin->repalm(); + reader->bunderlineLink = prefwin->UnderlineLink(); + reader->bkern = prefwin->kern(); reader->hyphenate = prefwin->hyphenate(); // reader->buffdoc.setCustomHyphen(prefwin->customhyphen()); reader->m_scrolltype = prefwin->scrolltype(); reader->m_scrollstep = prefwin->scrollstep(); m_scrollcolor = prefwin->scrollcolor(); setscrollcolour(); m_scrollbarcolor = prefwin->minibarcol(); @@ -2102,16 +2134,17 @@ void QTReaderApp::showprefs() reader->setForeground(getcolour(m_foreground)); m_background = prefwin->background(); reader->setBackground(getcolour(m_background)); m_twoTouch = prefwin->twotouch(); reader->setTwoTouch(m_twoTouch); m_touch_action->setOn(m_twoTouch); reader->bstripcr = prefwin->StripCR(); + reader->bNoInlineTables = !prefwin->InlineTables(); reader->bdehyphen = prefwin->Dehyphen(); reader->bonespace = prefwin->SingleSpace(); reader->bunindent = prefwin->Unindent(); reader->brepara = prefwin->Reparagraph(); reader->bdblspce = prefwin->DoubleSpace(); reader->bremap = prefwin->Remap(); reader->bmakebold = prefwin->Embolden(); reader->bfulljust = prefwin->FullJustify(); @@ -2144,29 +2177,31 @@ void QTReaderApp::showprefs() reader->bpeanut = true; break; default: qDebug("Format out of range"); } reader->bdepluck = prefwin->Depluck(); reader->bdejpluck = prefwin->Dejpluck(); reader->setContinuous(prefwin->Continuous()); + reader->setDoubleBuffer(prefwin->DoubleBuffer()); /* m_leftScroll = prefwin->leftScroll(); m_rightScroll = prefwin->rightScroll(); m_upScroll = prefwin->upScroll(); m_downScroll = prefwin->downScroll(); */ m_targetapp = prefwin->dictApplication(); m_targetmsg = prefwin->dictMessage(); m_doAnnotation = prefwin->miscannotation(); m_doDictionary = prefwin->miscdictionary(); m_doClipboard = prefwin->miscclipboard(); + m_doOutput = prefwin->miscoutput(); reader->m_swapmouse = prefwin->SwapMouse(); reader->setBaseSize(prefwin->gfxsize()); reader->m_overlap = prefwin->pageoverlap(); reader->m_bMonoSpaced = prefwin->ideogram(); m_setmono_action->setOn(reader->m_bMonoSpaced); reader->m_encd = prefwin->encoding(); reader->m_charpc = prefwin->ideogramwidth(); @@ -2178,16 +2213,25 @@ void QTReaderApp::showprefs() m_propogatefontchange = prefwin->propfontchange(); setfontHelper(prefwin->Font()); } if (m_bgtype != (bground)prefwin->bgtype()) { m_bgtype = (bground)prefwin->bgtype(); setBackgroundBitmap(); } + qDebug("OutCodec:%s", (const char*)prefwin->outcodec()); + if (reader->m_outputName != prefwin->outcodec()) + { + if (reader->m_output != NULL) + { + QMessageBox::warning(this, PROGNAME, "Change of output codec\nrequires a restart"); + } + reader->m_outputName = prefwin->outcodec(); + } delete prefwin; reader->setfilter(reader->getfilter()); reader->refresh(); } else { delete prefwin; } @@ -2285,22 +2329,46 @@ void QTReaderApp::showinfo() else { reader->sizes(fs,ts); ds = reader->buffdoc.endSection() - reader->buffdoc.startSection(); pl = reader->pagelocate(); dl = pl - reader->buffdoc.startSection(); m_infoWin->setFileSize(fs); m_infoWin->setTextSize(ts); - m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); + if (fs > UINT_MAX/100) + { + unsigned long t1 = (ts+50)/100; + m_infoWin->setRatio(100-(fs + (t1 >> 1))/t1); + } + else + { + m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); + } m_infoWin->setLocation(pl); - m_infoWin->setRead((100*pl + (ts >> 1))/ts); + if (pl > UINT_MAX/100) + { + unsigned long t1 = (ts+50)/100; + m_infoWin->setRead((pl + (t1 >> 1))/t1); + } + else + { + m_infoWin->setRead((100*pl + (ts >> 1))/ts); + } m_infoWin->setDocSize(ds); m_infoWin->setDocLocation(dl); - m_infoWin->setDocRead((100*dl + (ds >> 1))/ds); + if (dl > UINT_MAX/100) + { + unsigned long d1 = (ds+50)/100; + m_infoWin->setDocRead((dl + (d1 >> 1))/d1); + } + else + { + m_infoWin->setDocRead((100*dl + (ds >> 1))/ds); + } m_infoWin->setZoom(reader->m_fontControl.currentsize()*10); m_infoWin->setAbout(QString("\nApplication (c) Tim Wentford\n")+reader->about()); editorStack->raiseWidget( m_infoWin ); hidetoolbars(); m_infoWin->setFocus(); } } @@ -2737,17 +2805,17 @@ void QTReaderApp::search(const QString & arg) } #else void QTReaderApp::search() { findNext(); } #endif -void QTReaderApp::openFile( const QString &f ) +void QTReaderApp::openFile( const QString &f, unsigned int loc ) { // qDebug("File:%s", (const char*)f); // openFile(DocLnk(f)); //} // //void QTReaderApp::openFile( const DocLnk &f ) //{ clear(); @@ -2760,17 +2828,17 @@ void QTReaderApp::openFile( const QString &f ) { DocLnk d(f); QFileInfo fnew(d.file()); fm = fnew; if (!fm.exists()) return; } #endif clear(); - reader->setText(fm.baseName(), fm.absFilePath()); + reader->setText(fm.baseName(), fm.absFilePath(), loc); m_loadedconfig = readconfig(APPDIR "/configs", reader->m_string, false); qDebug("Showing tools"); showEditTools(); qDebug("Shown tools"); readbkmks(); qDebug("read markss"); m_savedpos = 0xffffffff; } @@ -2801,17 +2869,17 @@ void QTReaderApp::handlekey(QKeyEvent* e) unsigned long etime = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm; if (etime < m_debounce) { return; } switch(e->key()) { case Key_Escape: -// qDebug("escape event"); + qDebug("escape event"); if (m_disableesckey) { m_disableesckey = false; } else { m_bcloseDisabled = true; if (m_fullscreen) @@ -2886,50 +2954,51 @@ void QTReaderApp::handlekey(QKeyEvent* e) QString key; msg += key.setNum(e->key()); QMessageBox::information(this, PROGNAME, msg); */ } ftime(&m_lastkeytime); } -#ifdef NEWFULLSCREEN -void QTReaderApp::enableFullscreen() -{ - setFixedSize(qApp->desktop()->size()); - showNormal(); - reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); - showFullScreen(); -} - -void QTReaderApp::resizeEvent(QResizeEvent *) +#if defined(USEQPE) && defined(USENEWFULLSCREEN) +void QTReaderApp::focusInEvent(QFocusEvent *) { - if (m_fullscreen && (size() != qApp->desktop()->size())) + if (m_usenewfullscreen && m_fullscreen && (editorStack->visibleWidget() == reader)) { - enableFullscreen(); + m_usenewfullscreen = false; + reader->bDoUpdates = false; + showEditTools(); + reader->bDoUpdates = true; + reader->update(); + m_usenewfullscreen = true; } } -void QTReaderApp::focusInEvent(QFocusEvent*) +void QTReaderApp::resizeEvent(QResizeEvent *) { - if (m_fullscreen) + if (m_usenewfullscreen && m_fullscreen && (editorStack->visibleWidget() == reader)) { - enableFullscreen(); - raise(); + m_usenewfullscreen = false; + reader->bDoUpdates = false; + showEditTools(); + reader->bDoUpdates = true; + reader->update(); + m_usenewfullscreen = true; } } #endif void QTReaderApp::showEditTools() { // if ( !doc ) // close(); if (m_fullscreen) { -#ifdef USEQPE +#if defined(USEQPE) if (menubar != NULL) menubar->hide(); #endif if (fileBar != NULL) fileBar->hide(); if (viewBar != NULL) viewBar->hide(); if (navBar != NULL) navBar->hide(); if (markBar != NULL) markBar->hide(); if (m_prog != NULL) { @@ -2939,22 +3008,18 @@ void QTReaderApp::showEditTools() searchBar->hide(); regBar->hide(); #ifdef USEQPE Global::hideInputMethod(); #endif if (m_scrollbar != NULL) m_scrollbar->hide(); m_fontBar->hide(); // showNormal(); -#ifdef NEWFULLSCREEN - enableFullscreen(); -#else showFullScreen(); -#endif - } + } else { // qDebug("him"); #ifdef USEQPE Global::hideInputMethod(); #endif // qDebug("eb"); if (m_scrollbar != NULL) @@ -2965,17 +3030,17 @@ void QTReaderApp::showEditTools() } else { m_scrollbar->show(); } } if (!m_hidebars) { -#ifdef USEQPE +#if defined(USEQPE) menubar->show(); #endif if (fileBar != NULL) fileBar->show(); if (viewBar != NULL) viewBar->show(); if (navBar != NULL) navBar->show(); if (markBar != NULL) markBar->show(); if (m_prog != NULL && !m_statusishidden) { @@ -2999,30 +3064,30 @@ void QTReaderApp::showEditTools() Global::showInputMethod(); #endif regBar->show(); } if (m_fontVisible) m_fontBar->show(); // qDebug("sn"); showNormal(); // qDebug("sm"); -#ifdef USEQPE +#if defined(USEQPE) && !defined(SIMPAD) showMaximized(); #endif // setCentralWidget(reader); } // qDebug("uc"); updateCaption(); // qDebug("rw"); editorStack->raiseWidget( reader ); // qDebug("sf"); reader->setFocus(); // qDebug("ref"); - reader->refresh(true); + //reader->refresh(true); // qDebug("done"); } /* void QTReaderApp::save() { if ( !doc ) return; if ( !editor->edited() ) @@ -3169,41 +3234,51 @@ void QTReaderApp::do_gotomark() void QTReaderApp::do_delmark() { m_nBkmkAction = cDelBkmk; if (!listbkmk(pBkmklist)) QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); } -bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab) +bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab, bool presel) { bkmkselector->clear(); if (_lab.isEmpty()) bkmkselector->setText("Cancel"); else bkmkselector->setText(_lab); int cnt = 0; + int slt = -1; if (plist != NULL) { for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++) { + if (presel) + { + Bkmk* p = i.pContent(); + if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) + { + slt = cnt; + } + } #ifdef _UNICODE // qDebug("Item:%s", (const char*)toQString(i->name())); - bkmkselector->insertItem(toQString(i->name())); + bkmkselector->insertItem(toQString(i->name()), cnt++); #else - bkmkselector->insertItem(i->name()); + bkmkselector->insertItem(i->name(), cnt++); #endif - cnt++; + } } if (cnt > 0) { hidetoolbars(); editorStack->raiseWidget( bkmkselector ); + if (slt != -1) bkmkselector->setCurrentItem(slt); return true; } else return false; } void QTReaderApp::do_autogen() { @@ -3233,40 +3308,41 @@ bool QTReaderApp::openfrombkmk(Bkmk* bk) { QString fn = toQString( CFiledata(bk->anno()).name() ); // qDebug("fileinfo"); if (!fn.isEmpty() && QFileInfo(fn).isFile()) { // qDebug("Opening"); - openFile(fn); struct stat fnstat; - stat((const char *)reader->m_lastfile, &fnstat); + stat((const char *)fn, &fnstat); if (CFiledata(bk->anno()).date() != fnstat.st_mtime) { CFiledata fd(bk->anno()); fd.setdate(fnstat.st_mtime); bk->value(0); + reader->m_lastposn = 0; + openFile(fn); } else { unsigned short svlen = bk->filedatalen(); unsigned char* svdata = bk->filedata(); + openFile(fn, bk->value()); reader->putSaveData(svdata, svlen); // setstate(svdata, svlen); if (svlen != 0) { QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?"); } // qDebug("updating"); // showEditTools(); - reader->locate(bk->value()); } return true; } else { return false; } } @@ -3361,17 +3437,17 @@ void QTReaderApp::gotobkmk(int ind) QMessageBox::information(this, PROGNAME, "Couldn't open output"); } } #else /* USEQPE */ FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); if (fin != NULL) { bool allok = false; -#ifdef OPIE +#if defined(OPIE) && defined(OPIEFILEDIALOG) QString outfile = OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, QString::null, QString::null, MimeTypes(), 0, "OpieReader"); if (!outfile.isEmpty()) { FILE* fout = fopen((const char *)outfile, "w"); if (fout != NULL) { fprintf(fout, "<html><body>\n"); int ch = 0; @@ -3698,35 +3774,44 @@ void QTReaderApp::do_autogen(const QString& regText) pbar->raise(); pbar->reset(); reader->update(); qApp->processEvents(); reader->setFocus(); reader->jumpto(0); int lastpc = 0; int i = 0; + unsigned int llcn = reader->locate(); while (i >= 0) { - unsigned int lcn = reader->locate(); + unsigned int lcn = llcn; int pc = (100*lcn)/ts; if (pc != lastpc) { pbar->setProgress(pc); qApp->processEvents(); if (reader->locate() != lcn) reader->jumpto(lcn); reader->setFocus(); lastpc = pc; } i = reader->buffdoc.getpara(buff); #ifdef _UNICODE if (re.match(toQString(buff.data())) != -1) #else if (re.match(buff.data()) != -1) #endif pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); + /* + llcn = reader->locate(); + if ((i == 0) && (llcn+1 < ts)) + { + reader->jumpto(++llcn); + i = 1; + } + */ } pBkmklist->sort(); pbar->setProgress(100); qApp->processEvents(); pbar->hide(); reader->refresh(); } @@ -4027,16 +4112,20 @@ void QTReaderApp::showAnnotation() hidetoolbars(); m_annoWin->setFocus(); } void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, size_t posn2, const QString& line) { //// qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd); + if (m_doOutput && reader->checkoutput()) + { + reader->doOutput(wrd); + } if (m_doClipboard) { QClipboard* cb = QApplication::clipboard(); cb->setText(wrd); #ifdef USEQPE if (wrd.length() > 10) { Global::statusMessage(wrd.left(8) + ".."); @@ -4111,28 +4200,28 @@ void QTReaderApp::doAction(QKeyEvent* e) break; case cesInvertColours: m_inverse_action->setOn(!reader->bInverse); break; case cesToggleBars: m_hidebars = !m_hidebars; if (m_hidebars) { -#ifdef USEQPE +#if defined(USEQPE) menubar->hide(); #endif if (fileBar != NULL) fileBar->hide(); if (viewBar != NULL) viewBar->hide(); if (navBar != NULL) navBar->hide(); if (markBar != NULL) markBar->hide(); mb->hide(); } else { -#ifdef USEQPE +#if defined(USEQPE) menubar->show(); #endif if (fileBar != NULL) fileBar->show(); if (viewBar != NULL) viewBar->show(); if (navBar != NULL) navBar->show(); if (markBar != NULL) markBar->show(); mb->show(); } @@ -4335,16 +4424,17 @@ void QTReaderApp::do_saveconfig(const QString& _txt, bool full) fi.setFile(d, _txt); } // qDebug("Path:%s", (const char*)fi.absFilePath()); Config config(fi.absFilePath()); #endif config.writeEntry( "StripCr", reader->bstripcr ); + config.writeEntry( "NoInlineTables", reader->bNoInlineTables ); config.writeEntry( "AutoFmt", reader->bautofmt ); config.writeEntry( "TextFmt", reader->btextfmt ); config.writeEntry( "StripHtml", reader->bstriphtml ); config.writeEntry( "Dehyphen", reader->bdehyphen ); config.writeEntry( "Depluck", reader->bdepluck ); config.writeEntry( "Dejpluck", reader->bdejpluck ); config.writeEntry( "OneSpace", reader->bonespace ); config.writeEntry( "Unindent", reader->bunindent ); @@ -4360,16 +4450,17 @@ void QTReaderApp::do_saveconfig(const QString& _txt, bool full) config.writeEntry( "ScrollType", reader->m_scrolltype ); if (full) { config.writeEntry("Debounce", m_debounce); config.writeEntry("FloatDialogs", m_bFloatingDialog); reader->m_lastposn = reader->pagelocate(); config.writeEntry( "LastFile", reader->m_lastfile ); config.writeEntry( "LastPosn", (int)(reader->pagelocate()) ); + config.writeEntry( "OutputCodec", reader->m_outputName); } config.writeEntry( "PageMode", reader->m_bpagemode ); config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced ); config.writeEntry( "SwapMouse", reader->m_swapmouse); config.writeEntry( "IsRotated", reader->m_rotated ); config.writeEntry("StatusContent", m_statusstring); config.writeEntry("StatusHidden", m_statusishidden); config.writeEntry( "Background", m_background ); @@ -4391,36 +4482,40 @@ void QTReaderApp::do_saveconfig(const QString& _txt, bool full) #ifdef _SCROLLPIPE config.writeEntry( "PipeTarget", reader->m_pipetarget ); config.writeEntry( "PauseAfterPara", reader->m_pauseAfterEachPara ); #endif config.writeEntry( "TwoTouch", m_twoTouch ); config.writeEntry( "Annotation", m_doAnnotation); config.writeEntry( "Dictionary", m_doDictionary); config.writeEntry( "Clipboard", m_doClipboard); + config.writeEntry( "OutputTgt", m_doOutput); /* config.writeEntry( "SpaceTarget", m_spaceTarget); config.writeEntry( "EscapeTarget", m_escapeTarget); config.writeEntry( "ReturnTarget", m_returnTarget); config.writeEntry( "LeftTarget", m_leftTarget); config.writeEntry( "RightTarget", m_rightTarget); config.writeEntry( "UpTarget", m_upTarget); config.writeEntry( "DownTarget", m_downTarget); config.writeEntry("LeftScroll", m_leftScroll); config.writeEntry("RightScroll", m_rightScroll); config.writeEntry("UpScroll", m_upScroll); config.writeEntry("DownScroll", m_downScroll); */ config.writeEntry( "Repalm", reader->brepalm ); + config.writeEntry( "UnderlineLink", reader->bunderlineLink ); config.writeEntry( "HideScrollBar", m_scrollishidden ); + config.writeEntry( "HideToolBar", m_hidebars ); config.writeEntry( "Kern", reader->bkern ); config.writeEntry( "Remap", reader->bremap ); config.writeEntry( "Peanut", reader->bpeanut ); config.writeEntry( "MakeBold", reader->bmakebold ); config.writeEntry( "Continuous", reader->m_continuousDocument ); + config.writeEntry( "DoubleBuffer", reader->m_doubleBuffered); config.writeEntry( "FullJust", reader->bfulljust ); // config.writeEntry( "Negative", reader->bNegative ); config.writeEntry( "Inverse", reader->bInverse ); config.writeEntry( "FixGraphics", reader->m_fontControl.FixGraphics()); config.writeEntry( "ExtraSpace", reader->getextraspace() ); config.writeEntry( "ExtraLead", reader->getlead() ); config.writeEntry( "Basesize", (int)reader->getBaseSize()); config.writeEntry( "RequestorFontChange", m_propogatefontchange); @@ -4514,16 +4609,17 @@ bool QTReaderApp::readconfig(const QString& dirname, const QString& _txt, bool f config.setGroup("Toolbar"); m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", m_tbmovesave); m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", m_tbpolsave); m_tbposition = (ToolBarDock)config.readNumEntry("Position", m_tbposition); } config.setGroup( "View" ); m_bFloatingDialog = config.readBoolEntry("FloatDialogs", m_bFloatingDialog); reader->bstripcr = config.readBoolEntry( "StripCr", reader->bstripcr ); + reader->bNoInlineTables = config.readBoolEntry( "NoInlineTables", reader->bNoInlineTables ); reader->bfulljust = config.readBoolEntry( "FullJust", reader->bfulljust ); reader->bInverse = config.readBoolEntry( "Inverse", reader->bInverse ); // reader->bNegative = config.readBoolEntry( "Negative", false ); reader->m_fontControl.FixGraphics(config.readBoolEntry( "FixGraphics", reader->m_fontControl.FixGraphics() )); reader->setextraspace(config.readNumEntry( "ExtraSpace", reader->getextraspace() )); reader->setlead(config.readNumEntry( "ExtraLead", reader->getlead() )); reader->btextfmt = config.readBoolEntry( "TextFmt", reader->btextfmt ); reader->bautofmt = config.readBoolEntry( "AutoFmt", reader->bautofmt ); @@ -4569,37 +4665,43 @@ bool QTReaderApp::readconfig(const QString& dirname, const QString& _txt, bool f reader->m_encd = config.readNumEntry( "Encoding", reader->m_encd ); reader->m_charpc = config.readNumEntry( "CharSpacing", reader->m_charpc ); reader->m_overlap = config.readNumEntry( "Overlap", reader->m_overlap ); reader->m_abstopmargin = config.readNumEntry( "Top Margin", reader->m_abstopmargin ); reader->m_absbottommargin = config.readNumEntry( "Bottom Margin", reader->m_absbottommargin ); reader->m_absleft_border = config.readNumEntry( "Left Margin", reader->m_absleft_border ); reader->m_absright_border = config.readNumEntry( "Right Margin", reader->m_absright_border ); m_scrollishidden = config.readBoolEntry( "HideScrollBar", m_scrollishidden ); + m_hidebars = config.readBoolEntry( "HideToolBar", m_hidebars ); reader->brepalm = config.readBoolEntry( "Repalm", reader->brepalm ); + reader->bunderlineLink = config.readBoolEntry( "UnderlineLink", reader->bunderlineLink ); reader->bkern = config.readBoolEntry( "Kern", reader->bkern ); reader->bremap = config.readBoolEntry( "Remap", reader->bremap ); reader->bmakebold = config.readBoolEntry( "MakeBold", reader->bmakebold ); reader->setContinuous(config.readBoolEntry( "Continuous", reader->m_continuousDocument )); + reader->setDoubleBuffer(config.readBoolEntry("DoubleBuffer", reader->m_doubleBuffered)); m_targetapp = config.readEntry( "TargetApp", m_targetapp ); m_targetmsg = config.readEntry( "TargetMsg", m_targetmsg ); #ifdef _SCROLLPIPE reader->m_pipetarget = config.readEntry( "PipeTarget", reader->m_pipetarget ); reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", reader->m_pauseAfterEachPara ); #endif m_twoTouch = config.readBoolEntry( "TwoTouch", m_twoTouch); m_doAnnotation = config.readBoolEntry( "Annotation", m_doAnnotation); m_doDictionary = config.readBoolEntry( "Dictionary", m_doDictionary); m_doClipboard = config.readBoolEntry( "Clipboard", m_doClipboard); + m_doOutput = config.readBoolEntry( "OutputTgt", m_doOutput); #ifdef USEQPE m_grabkeyboard = config.readBoolEntry( "GrabKeyboard", m_grabkeyboard); #endif m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", m_propogatefontchange); reader->setBaseSize(config.readNumEntry( "Basesize", reader->getBaseSize() )); reader->setTwoTouch(m_twoTouch); + + reader->m_outputName = config.readEntry( "OutputCodec", reader->m_outputName); m_touch_action->setOn(m_twoTouch); m_setmono_action->setOn(reader->m_bMonoSpaced); setfontHelper(reader->m_fontname); if (full) { addtoolbars(&config); } @@ -4632,18 +4734,17 @@ bool QTReaderApp::PopulateConfig(const char* tgtdir, bool usedirs) // d.setSorting( QDir::Size | QDir::Reversed ); const QFileInfoList *list = d.entryInfoList(); QFileInfoListIterator it( *list ); // create list iterator QFileInfo *fi; // pointer for traversing while ( (fi=it.current()) ) { // for each file... - bkmkselector->insertItem(fi->fileName()); - cnt++; + bkmkselector->insertItem(fi->fileName(), cnt++); //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); ++it; // goto next list element } #else /* USEQPE */ int cnt = 0; DIR *d; @@ -4658,18 +4759,17 @@ bool QTReaderApp::PopulateConfig(const char* tgtdir, bool usedirs) { struct dirent* de; struct stat buf; de = readdir(d); if (de == NULL) break; if (lstat((const char *)Global::applicationFileName(finaldir,de->d_name),&buf) == 0 && ((usedirs && S_ISDIR(buf.st_mode)) || (!usedirs && S_ISREG(buf.st_mode)))) { - bkmkselector->insertItem(de->d_name); - cnt++; + bkmkselector->insertItem(de->d_name, cnt++); } } delete [] finaldir; closedir(d); #endif return (cnt > 0); } @@ -4730,16 +4830,18 @@ void QTReaderApp::OnURLSelected(const QString& href, const size_t tgt) { QString type = href.left(col); qDebug("Type:%s", (const char*)type); } else { qDebug("No type"); } + QString msg = "External URL\n" + href; + QMessageBox::information(this, PROGNAME, msg); #else if (href.isEmpty()) { QMessageBox::information(this, PROGNAME, "No URL information supplied"); } else { CURLDialog* urld = new CURLDialog(href, false, this); @@ -4896,33 +4998,37 @@ void QTReaderApp::setscrollbarcolour() void QTReaderApp::forceopen(const QString& filename) { /* QFileInfo fi(reader->m_lastfile); fi = QFileInfo(filename); QString flnm = fi.absFilePath(); */ - if (!filename.isEmpty()) + if (!filename.isEmpty() && QFileInfo(filename).exists()) { updatefileinfo(); if (pBkmklist != NULL) { if (m_fBkmksChanged) { savebkmks(); } delete pBkmklist; pBkmklist = NULL; m_fBkmksChanged = false; } reader->disableAutoscroll(); openFile(filename); reader->setFocus(); } + else + { + OnURLSelected(filename, 0); + } } void QTReaderApp::actionscroll(int v) { if (reader->m_rotated) { reader->dopageup(reader->buffdoc.startSection()+reader->buffdoc.endSection()-v); } |