summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/QTReaderApp.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-reader/QTReaderApp.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.cpp238
1 files changed, 172 insertions, 66 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
@@ -8,24 +8,25 @@
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** 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>
#include <qtoolbar.h>
#ifdef USEQPE
#include <qpe/menubutton.h>
#endif
@@ -57,47 +58,52 @@
#include "GraphicWin.h"
#include "Bkmks.h"
#include "cbkmkselector.h"
#include "infowin.h"
#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
//#define PICDIR "/home/tim/uqtreader/pics/"
QString picdir()
{
QString hd(getenv("READERDIR"));
@@ -144,74 +150,71 @@ void QTReaderApp::listBkmkFiles()
d.cd(APPDIR);
}
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;
d = opendir((const char *)Global::applicationFileName(APPDIR,""));
while(1)
{
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();
editorStack->raiseWidget( bkmkselector );
hidetoolbars();
m_nBkmkAction = cRmBkmkFile;
}
else
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();
if (markBar != NULL) markBar->hide();
if (m_fontVisible) m_fontBar->hide();
if (regVisible)
{
@@ -324,32 +327,32 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
config.setGroup("Toolbar");
m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false);
m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1);
m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2);
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 );
QPopupMenu *navigation = new QPopupMenu(mb);
tmp->insertItem( tr( "Navigation" ), navigation );
@@ -427,59 +430,65 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
reader = new QTReader( editorStack );
reader->setDoUpdates(false);
#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 ));
reader->bfulljust = config.readBoolEntry( "FullJust", false );
/*
bool btmp = config.readBoolEntry("Negative", false);
if (btmp) reader->setNegative();
*/
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%%");
m_statusishidden = config.readBoolEntry("StatusHidden", false);
m_background = config.readNumEntry( "Background", 0 );
reader->setBackground(getcolour(m_background));
m_foreground = config.readNumEntry( "Foreground", 1 );
@@ -491,40 +500,44 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
reader->hyphenate = config.readBoolEntry( "Hyphenate", false );
reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false);
reader->m_fontname = config.readEntry( "Fontname", "helvetica" );
reader->m_encd = config.readNumEntry( "Encoding", 0 );
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);
m_leftScroll = config.readBoolEntry("LeftScroll", false);
m_rightScroll = config.readBoolEntry("RightScroll", false);
m_upScroll = config.readBoolEntry("UpScroll", true);
@@ -833,24 +846,36 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
marks->insertSeparator();
m_startBlock_action->addTo( marks );
m_endBlock_action = new QAction( tr( "Copy Block" ), geticon( "copy" ), QString::null, 0, this, NULL);
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 );
connect(searchBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() ));
searchEdit = new QLineEdit( searchBar, "searchEdit" );
// QFont f("unifont", 16 /*, QFont::Bold*/);
@@ -963,24 +988,25 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
setBackgroundBitmap();
m_inverse_action->setOn(reader->bInverse);
reader->init();
// 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)
{
/*
int ind = 0;
Bkmk* p = (*pOpenlist)[ind];
while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile)
@@ -1023,31 +1049,31 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
{
showEditTools();
}
// qApp->processEvents();
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())
{
QMessageBox::warning(this, PROGNAME, "You haven't mapped any keys yet!\n\nYou will be taken to the key\nmapping dialog.\nA few defaults are provided\nbut you can change then to\nsuit yourself.\n\nYou can change the key\nmapping at any time by\nselecting the Settings/Button\noption on the menu.");
m_buttonprefs->mapkey(Qt::NoButton, Key_Up, cesPageUp);
m_buttonprefs->mapkey(Qt::NoButton, Key_Down, cesPageDown);
@@ -1056,25 +1082,25 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
m_buttonprefs->mapkey(Qt::NoButton, Key_Left, cesZoomOut);
showbuttonprefs();
}
}
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() );
m_close_action->removeFrom( filebar() );
m_info_action->removeFrom( filebar() );
m_touch_action->removeFrom( filebar() );
m_find_action->removeFrom( filebar() );
@@ -1084,25 +1110,25 @@ void QTReaderApp::addtoolbars(Config* config)
#endif
}
m_preferences_action->addTo( filebar() );
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() );
m_jump_action->removeFrom( navbar() );
m_pageline_action->removeFrom( navbar() );
m_pageup_action->removeFrom( navbar() );
m_pagedn_action->removeFrom( navbar() );
@@ -1123,25 +1149,25 @@ void QTReaderApp::addtoolbars(Config* config)
addnavbar(config, "Jump", m_jump_action);
addnavbar(config, "Page/Line Scroll", m_pageline_action);
addnavbar(config, "Page Up", m_pageup_action);
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() );
m_zoomin_action->removeFrom( viewbar() );
m_zoomout_action->removeFrom( viewbar() );
m_setfont_action->removeFrom( viewbar() );
m_setenc_action->removeFrom( viewbar() );
@@ -1155,25 +1181,25 @@ void QTReaderApp::addtoolbars(Config* config)
addviewbar(config, "Fullscreen", m_actFullscreen);
addviewbar(config, "Rotate", m_rotate_action);
addviewbar(config, "Invert Action", m_inverse_action);
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() );
m_delete_action->removeFrom( markbar() );
m_autogen_action->removeFrom( markbar() );
m_clear_action->removeFrom( markbar() );
m_save_action->removeFrom( markbar() );
@@ -1224,25 +1250,25 @@ void QTReaderApp::addtoolbars(Config* config)
bool QTReaderApp::checkbar(Config* _config, const QString& key)
{
return _config->readBoolEntry(key, false);
}
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:
case cesMultiple:
// qDebug("Creating new file bar");
fileBar = new QToolBar("File", this, m_tbposition);
break;
@@ -1708,43 +1734,41 @@ void QTReaderApp::setrotated(bool sfs)
m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::BottomToTop : QBoxLayout::TopToBottom );
if (m_scrollbar != NULL)
{
scrollbar->disconnect();
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)
{
((QPEApplication*)qApp)->grabKeyboard();
}
else
{
@@ -1919,48 +1943,48 @@ void QTReaderApp::fileOpen2()
reader->pBkmklist = pBkmklist = NULL;
m_fBkmksChanged = false;
}
reader->disableAutoscroll();
/*
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);
}
reader->setFocus();
}
// reader->refresh();
// qDebug("HEIGHT:%d", reader->m_lastheight);
}
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"), "*/*" );
fn = OFileDialog::getOpenFileName(OFileSelector::EXTENDED_ALL, QFileInfo(reader->m_lastfile).dirPath(true), QString::null, mimeTypes, 0, "OpieReader");
#else
fileBrowser* fb = new fileBrowser(false, this,"OpieReader",!m_bFloatingDialog,
0,
@@ -1994,36 +2018,38 @@ void QTReaderApp::showbuttonprefs()
hidetoolbars();
m_buttonprefs->setFocus();
m_kmapchanged = true;
}
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);
// prefwin->Inverse(reader->bInverse);
// prefwin->Negative(reader->bNegative);
prefwin->FixGraphics(reader->m_fontControl.FixGraphics());
prefwin->ParaLead(reader->getextraspace());
@@ -2047,75 +2073,82 @@ void QTReaderApp::showprefs()
}
else if (reader->bpeanut)
{
prefwin->Markup(4);
}
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();
setscrollbarcolour();
m_foreground = prefwin->foreground();
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();
// if (reader->bInverse != prefwin->Inverse()) reader->setInverse(prefwin->Inverse());
// if (reader->bNegative != prefwin->Negative()) reader->setNegative();
reader->m_fontControl.FixGraphics(prefwin->FixGraphics());
@@ -2140,58 +2173,69 @@ void QTReaderApp::showprefs()
case 3:
reader->bstriphtml = true;
break;
case 4:
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();
if (
reader->m_fontname != prefwin->Font()
||
m_propogatefontchange != prefwin->propfontchange())
{
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;
}
}
void QTReaderApp::showtoolbarprefs()
{
@@ -2281,30 +2325,54 @@ void QTReaderApp::showinfo()
if (reader->empty())
{
QMessageBox::information(this, PROGNAME, "No file loaded", 1);
}
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);
+ 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);
+ 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);
+ 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();
}
}
void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn, size_t posn2)
{
if (pBkmklist == NULL) reader->pBkmklist = pBkmklist = new CList<Bkmk>;
#ifdef _UNICODE
@@ -2733,48 +2801,48 @@ void QTReaderApp::search(const QString & arg)
reader->jumpto(start);
searchStack->push(new searchrecord(arg,start));
}
dosearch(start, test, 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();
QFileInfo fm(f);
if ( fm.exists() )
{
// QMessageBox::information(0, "Progress", "Calling fileNew()");
#ifdef USEQPE
if (fm.extension( FALSE ) == "desktop")
{
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;
}
else
{
QString msg = f;
msg += "\nFile does not exist";
@@ -2797,25 +2865,25 @@ void QTReaderApp::handlekey(QKeyEvent* e)
{
// qDebug("Keypress event");
timeb now;
ftime(&now);
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)
{
m_actFullscreen->setOn(false);
e->accept();
}
@@ -2882,104 +2950,101 @@ void QTReaderApp::handlekey(QKeyEvent* e)
}
/*
QString msg("Key press was:");
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)
{
// qDebug("Hiding status");
m_prog->hide();
}
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)
{
if (m_scrollishidden)
{
m_scrollbar->hide();
}
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)
{
// qDebug("Showing status");
m_prog->show();
// qDebug("Shown status");
}
@@ -2995,38 +3060,38 @@ void QTReaderApp::showEditTools()
}
if ( regVisible )
{
#ifdef USEQPE
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() )
return;
QString rt = editor->text();
QString pt = rt;
@@ -3165,49 +3230,59 @@ void QTReaderApp::do_gotomark()
m_nBkmkAction = cGotoBkmk;
if (!listbkmk(pBkmklist))
QMessageBox::information(this, PROGNAME, "No bookmarks in memory");
}
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()
{
m_nRegAction = cAutoGen;
regEdit->setText(m_autogenstr);
do_regedit();
}
@@ -3229,48 +3304,49 @@ void QTReaderApp::do_regedit()
reader->update();
}
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;
}
}
void QTReaderApp::gotobkmk(int ind)
{
qDebug("gbkmk");
@@ -3357,25 +3433,25 @@ void QTReaderApp::gotobkmk(int ind)
}
fclose(fout);
}
else
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;
while ((ch = fgetc(fin)) != EOF)
{
fputc(ch, fout);
}
@@ -3694,43 +3770,52 @@ void QTReaderApp::do_autogen(const QString& regText)
m_fBkmksChanged = true;
pbar->setGeometry(regBar->x(),regBar->y(),regBar->width(), regBar->height());
pbar->show();
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();
}
void QTReaderApp::saveprefs()
{
do_saveconfig( APPDIR, true );
savefilelist();
@@ -4023,24 +4108,28 @@ void QTReaderApp::showAnnotation()
#ifdef USEQPE
Global::showInputMethod();
#endif
editorStack->raiseWidget( m_annoWin );
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) + "..");
}
else
{
Global::statusMessage(wrd);
@@ -4107,36 +4196,36 @@ void QTReaderApp::doAction(QKeyEvent* e)
case cesNextLink:
{
reader->getNextLink();
}
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();
}
break;
case cesToggleScrollBar:
if (m_scrollbar != NULL)
{
@@ -4331,24 +4420,25 @@ void QTReaderApp::do_saveconfig(const QString& _txt, bool full)
d.cd(APPDIR);
d.mkdir("configs");
d.cd("configs");
}
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 );
config.writeEntry( "Repara", reader->brepara );
config.writeEntry( "ReparaString", reader->m_reparastring);
config.writeEntry( "BackgroundType" , (int)m_bgtype );
config.writeEntry( "Theme", m_themename );
@@ -4356,24 +4446,25 @@ void QTReaderApp::do_saveconfig(const QString& _txt, bool full)
config.writeEntry( "Indent", reader->bindenter );
config.writeEntry( "FontSize", (int)(reader->m_fontControl.currentsize()) );
config.writeEntry( "ScrollDelay", reader->m_delay);
config.writeEntry( "ScrollStep", reader->m_scrollstep);
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 );
config.writeEntry( "Foreground", m_foreground );
config.writeEntry( "ScrollColour", m_scrollcolor );
config.writeEntry( "ScrollBarColour", m_scrollbarcolor );
config.writeEntry( "Hyphenate", reader->hyphenate );
@@ -4387,44 +4478,48 @@ void QTReaderApp::do_saveconfig(const QString& _txt, bool full)
config.writeEntry( "Left Margin", (int)reader->m_absleft_border );
config.writeEntry( "Right Margin", (int)reader->m_absright_border );
config.writeEntry( "TargetApp", m_targetapp );
config.writeEntry( "TargetMsg", m_targetmsg );
#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);
#ifdef USEQPE
config.writeEntry( "GrabKeyboard", m_grabkeyboard );
#endif
if (full)
@@ -4510,24 +4605,25 @@ bool QTReaderApp::readconfig(const QString& dirname, const QString& _txt, bool f
Config config(fullname);
#endif
if (full)
{
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 );
reader->bstriphtml = config.readBoolEntry( "StripHtml", reader->bstriphtml );
reader->bpeanut = config.readBoolEntry( "Peanut", reader->bpeanut );
reader->bdehyphen = config.readBoolEntry( "Dehyphen", reader->bdehyphen );
reader->bdepluck = config.readBoolEntry( "Depluck", reader->bdepluck );
@@ -4565,46 +4661,52 @@ bool QTReaderApp::readconfig(const QString& dirname, const QString& _txt, bool f
reader->hyphenate = config.readBoolEntry( "Hyphenate", reader->hyphenate );
// reader->buffdoc.setCustomHyphen(config.readBoolEntry( "CustomHyphen", false ));
reader->m_swapmouse = config.readBoolEntry( "SwapMouse", reader->m_swapmouse);
reader->m_fontname = config.readEntry( "Fontname", reader->m_fontname );
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);
}
reader->setfilter(reader->getfilter());
reader->refresh();
return true;
}
@@ -4628,52 +4730,50 @@ bool QTReaderApp::PopulateConfig(const char* tgtdir, bool usedirs)
d.mkdir(tgtdir);
d.cd(tgtdir);
}
d.setFilter( ((usedirs) ? QDir::Dirs : 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;
char* finaldir;
finaldir = new char[strlen(APPDIR)+1+strlen(tgtdir)+1];
strcpy(finaldir, APPDIR);
strcat(finaldir, "/");
strcat(finaldir, tgtdir);
d = opendir((const char *)Global::applicationFileName(finaldir,""));
while(1)
{
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);
}
void QTReaderApp::LoadTheme()
{
if (PopulateConfig("Themes", true))
{
@@ -4726,24 +4826,26 @@ void QTReaderApp::OnURLSelected(const QString& href, const size_t tgt)
#ifndef USEQPE
qDebug("URL:%s", (const char*)href);
int col = href.find(':');
if (col > 0)
{
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);
urld->clipboard(m_url_clipboard);
urld->localfile(m_url_localfile);
urld->globalfile(m_url_globalfile);
if (urld->exec())
@@ -4892,41 +4994,45 @@ void QTReaderApp::setscrollbarcolour()
reader->m_scrollcolor.setRgb(255^r, 255^g, 255^b);
*/
reader->m_scrollbarcolor = getcolour(m_scrollbarcolor);
}
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);
}
else
{
/*
if (reader->pagelocate() < v)