summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/Bkmks.cpp182
-rw-r--r--noncore/apps/opie-reader/BuffDoc.cpp86
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.cpp942
3 files changed, 605 insertions, 605 deletions
diff --git a/noncore/apps/opie-reader/Bkmks.cpp b/noncore/apps/opie-reader/Bkmks.cpp
index 92ed69f..0cb9ea9 100644
--- a/noncore/apps/opie-reader/Bkmks.cpp
+++ b/noncore/apps/opie-reader/Bkmks.cpp
@@ -17,16 +17,16 @@ Bkmk::Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p) : m_position(_
for (int i = 0; i < len; i++) m_name[i] = _nm[i];
if (_anno == NULL)
{
- m_anno = new tchar[1];
- m_anno[0] = 0;
+ m_anno = new tchar[1];
+ m_anno[0] = 0;
}
else
{
- len = ustrlen(_anno)+1;
- m_anno = new tchar[len];
- for (int i = 0; i < len; i++) m_anno[i] = _anno[i];
+ len = ustrlen(_anno)+1;
+ m_anno = new tchar[len];
+ for (int i = 0; i < len; i++) m_anno[i] = _anno[i];
}
}
Bkmk::~Bkmk()
@@ -40,32 +40,32 @@ Bkmk::~Bkmk()
Bkmk& Bkmk::operator=(const Bkmk& rhs)
{
if (m_name != NULL)
{
- delete [] m_name;
- m_name = NULL;
+ delete [] m_name;
+ m_name = NULL;
}
if (m_anno != NULL)
{
- delete [] m_anno;
- m_anno = NULL;
+ delete [] m_anno;
+ m_anno = NULL;
}
if (rhs.m_name != NULL)
{
- int len = ustrlen(rhs.m_name)+1;
- m_name = new tchar[len];
- for (int i = 0; i < len; i++) m_name[i] = rhs.m_name[i];
+ int len = ustrlen(rhs.m_name)+1;
+ m_name = new tchar[len];
+ for (int i = 0; i < len; i++) m_name[i] = rhs.m_name[i];
}
else
- m_name = NULL;
+ m_name = NULL;
if (rhs.m_anno != NULL)
{
- int len = ustrlen(rhs.m_anno)+1;
- m_anno = new tchar[len];
- for (int i = 0; i < len; i++) m_anno[i] = rhs.m_anno[i];
+ int len = ustrlen(rhs.m_anno)+1;
+ m_anno = new tchar[len];
+ for (int i = 0; i < len; i++) m_anno[i] = rhs.m_anno[i];
}
else
- m_anno = NULL;
+ m_anno = NULL;
m_position = rhs.m_position;
return *this;
}
@@ -77,32 +77,32 @@ bool Bkmk::operator==(const Bkmk& rhs)
void Bkmk::setAnno(tchar* t)
{
if (m_anno != NULL)
{
- delete [] m_anno;
- m_anno = NULL;
+ delete [] m_anno;
+ m_anno = NULL;
}
if (t != NULL)
{
- int len = ustrlen(t)+1;
- m_anno = new tchar[len];
- for (int i = 0; i < len; i++) m_anno[i] = t[i];
+ int len = ustrlen(t)+1;
+ m_anno = new tchar[len];
+ for (int i = 0; i < len; i++) m_anno[i] = t[i];
}
else
- m_anno = NULL;
+ m_anno = NULL;
}
BkmkFile::BkmkFile(const char *fnm, bool w = false)
:
wt(w), isUpgraded(false)
{
if (w)
{
- f = fopen(fnm, "wb");
+ f = fopen(fnm, "wb");
}
else
{
- f = fopen(fnm, "rb");
+ f = fopen(fnm, "rb");
}
}
BkmkFile::~BkmkFile()
@@ -113,15 +113,15 @@ BkmkFile::~BkmkFile()
void BkmkFile::write(tchar* nm, tchar* an, const unsigned int& pos)
{
if (f != NULL)
{
- unsigned short ln = ustrlen(nm);
- fwrite(&ln,sizeof(ln),1,f);
- fwrite(nm,sizeof(tchar),ln,f);
- ln = ustrlen(an);
- fwrite(&ln,sizeof(ln),1,f);
- if (ln > 0) fwrite(an,sizeof(tchar),ln,f);
- fwrite(&pos,sizeof(pos),1,f);
+ unsigned short ln = ustrlen(nm);
+ fwrite(&ln,sizeof(ln),1,f);
+ fwrite(nm,sizeof(tchar),ln,f);
+ ln = ustrlen(an);
+ fwrite(&ln,sizeof(ln),1,f);
+ if (ln > 0) fwrite(an,sizeof(tchar),ln,f);
+ fwrite(&pos,sizeof(pos),1,f);
}
}
void BkmkFile::write(const Bkmk& b) { write(b.name(), b.anno(), b.value()); }
@@ -129,35 +129,35 @@ void BkmkFile::write(const Bkmk& b) { write(b.name(), b.anno(), b.value()); }
void BkmkFile::write(CList<Bkmk>& bl)
{
if (f != NULL)
{
- fwrite(&magic, sizeof(magic), 1, f);
- for (CList<Bkmk>::iterator i = bl.begin(); i != bl.end(); i++)
- {
- write(*i);
- }
+ fwrite(&magic, sizeof(magic), 1, f);
+ for (CList<Bkmk>::iterator i = bl.begin(); i != bl.end(); i++)
+ {
+ write(*i);
+ }
}
}
Bkmk* BkmkFile::read()
{
Bkmk* b = NULL;
if (f != NULL)
{
- unsigned short ln;
- if (fread(&ln,sizeof(ln),1,f) == 1)
- {
- b = new Bkmk;
- b->m_name = new tchar[ln+1];
- fread(b->m_name,sizeof(tchar),ln,f);
- b->m_name[ln] = 0;
-
- fread(&ln,sizeof(ln),1,f);
- b->m_anno = new tchar[ln+1];
- if (ln > 0) fread(b->m_anno,sizeof(tchar),ln,f);
- b->m_anno[ln] = 0;
- fread(&b->m_position,sizeof(b->m_position),1,f);
- }
+ unsigned short ln;
+ if (fread(&ln,sizeof(ln),1,f) == 1)
+ {
+ b = new Bkmk;
+ b->m_name = new tchar[ln+1];
+ fread(b->m_name,sizeof(tchar),ln,f);
+ b->m_name[ln] = 0;
+
+ fread(&ln,sizeof(ln),1,f);
+ b->m_anno = new tchar[ln+1];
+ if (ln > 0) fread(b->m_anno,sizeof(tchar),ln,f);
+ b->m_anno[ln] = 0;
+ fread(&b->m_position,sizeof(b->m_position),1,f);
+ }
}
return b;
}
@@ -165,28 +165,28 @@ CList<Bkmk>* BkmkFile::readall()
{
CList<Bkmk>* bl = NULL;
if (f != NULL)
{
- unsigned long newmagic;
- fread(&newmagic, sizeof(newmagic), 1, f);
- if (newmagic != magic)
- {
- if (QMessageBox::warning(NULL, "Old bookmark file!", "Which version of QTReader\ndid you upgrade from?", "0_4*", "Any other version") == 0)
- {
- fseek(f,0,SEEK_SET);
- bl = readall04();
- }
- else
- {
- fseek(f,0,SEEK_SET);
- bl = readall03();
- }
- isUpgraded = true;
- }
- else
- {
- bl = readall04();
- }
+ unsigned long newmagic;
+ fread(&newmagic, sizeof(newmagic), 1, f);
+ if (newmagic != magic)
+ {
+ if (QMessageBox::warning(NULL, "Old bookmark file!", "Which version of OpieReader\ndid you upgrade from?", "0_4*", "Any other version") == 0)
+ {
+ fseek(f,0,SEEK_SET);
+ bl = readall04();
+ }
+ else
+ {
+ fseek(f,0,SEEK_SET);
+ bl = readall03();
+ }
+ isUpgraded = true;
+ }
+ else
+ {
+ bl = readall04();
+ }
}
return bl;
}
@@ -194,12 +194,12 @@ CList<Bkmk>* BkmkFile::readall04()
{
CList<Bkmk>* bl = new CList<Bkmk>;
while (1)
{
- Bkmk* b = read();
- if (b == NULL) break;
- bl->push_back(*b);
- delete b;
+ Bkmk* b = read();
+ if (b == NULL) break;
+ bl->push_back(*b);
+ delete b;
}
return bl;
}
@@ -207,12 +207,12 @@ CList<Bkmk>* BkmkFile::readall03()
{
CList<Bkmk>* bl = new CList<Bkmk>;
while (1)
{
- Bkmk* b = read03();
- if (b == NULL) break;
- bl->push_back(*b);
- delete b;
+ Bkmk* b = read03();
+ if (b == NULL) break;
+ bl->push_back(*b);
+ delete b;
}
return bl;
}
@@ -220,21 +220,21 @@ Bkmk* BkmkFile::read03()
{
Bkmk* b = NULL;
if (f != NULL)
{
- unsigned short ln;
- if (fread(&ln,sizeof(ln),1,f) == 1)
- {
- b = new Bkmk;
- b->m_name = new tchar[ln+1];
- fread(b->m_name,sizeof(tchar),ln,f);
- b->m_name[ln] = 0;
+ unsigned short ln;
+ if (fread(&ln,sizeof(ln),1,f) == 1)
+ {
+ b = new Bkmk;
+ b->m_name = new tchar[ln+1];
+ fread(b->m_name,sizeof(tchar),ln,f);
+ b->m_name[ln] = 0;
- ln = 0;
- b->m_anno = new tchar[ln+1];
- b->m_anno[ln] = 0;
+ ln = 0;
+ b->m_anno = new tchar[ln+1];
+ b->m_anno[ln] = 0;
- fread(&b->m_position,sizeof(b->m_position),1,f);
- }
+ fread(&b->m_position,sizeof(b->m_position),1,f);
+ }
}
return b;
}
diff --git a/noncore/apps/opie-reader/BuffDoc.cpp b/noncore/apps/opie-reader/BuffDoc.cpp
index e37b136..d4541ea 100644
--- a/noncore/apps/opie-reader/BuffDoc.cpp
+++ b/noncore/apps/opie-reader/BuffDoc.cpp
@@ -12,10 +12,10 @@ bool BuffDoc::hyperlink(unsigned int n)
lastsizes[0] = laststartline = n;
lastispara = false;
if (exp != NULL)
{
- bRet = exp->hyperlink(n);
- lastsizes[0] = laststartline = exp->locate();
+ bRet = exp->hyperlink(n);
+ lastsizes[0] = laststartline = exp->locate();
}
return bRet;
}
@@ -36,11 +36,11 @@ bool BuffDoc::getline(CDrawBuffer* buff, int w)
CStyle cs;
buff->empty();
if (exp == NULL)
{
-// (*buff)[0] = '\0';
- buff->empty();
- return false;
+// (*buff)[0] = '\0';
+ buff->empty();
+ return false;
}
int len = 0, lastcheck = 0;
if (lastword.length() > 0)
{
@@ -53,11 +53,11 @@ bool BuffDoc::getline(CDrawBuffer* buff, int w)
unsigned int slen = buff->width(len);
if (slen > w)
{
for ( ; len > 0; len--)
- {
- if (buff->width(len) < w) break;
- }
+ {
+ if (buff->width(len) < w) break;
+ }
// lastword = buff->data() + len - 1;
laststartline = lastsizes[len-1];
lastword.setright(*buff, len - 1);
for (int i = 0; i < buff->length(); i++) lastsizes[i] = lastsizes[i+len-1];
@@ -87,22 +87,22 @@ bool BuffDoc::getline(CDrawBuffer* buff, int w)
allsizes[len] = exp->locate();
getch(ch, cs);
while (ch != ' ' && ch != '\012' && ch != UEOF && len < 128)
{
- len++;
- buff->addch(ch,cs);
- allsizes[len] = exp->locate();
- getch(ch, cs);
+ len++;
+ buff->addch(ch,cs);
+ allsizes[len] = exp->locate();
+ getch(ch, cs);
}
(*buff)[len] = 0;
slen = buff->width(len);
len++;
buff->addch(' ', cs);
allsizes[len] = exp->locate();
if (slen < w && ch != ' ')
{
- lastcheck = len;
- break;
+ lastcheck = len;
+ break;
}
lastispara = (ch == '\012');
}
(*buff)[len] = '\0';
@@ -129,19 +129,19 @@ bool BuffDoc::getline(CDrawBuffer* buff, int w, int cw)
{
buff->empty();
if (exp == NULL)
{
- return false;
+ return false;
}
tchar ch;
CStyle cs;
int i = 0;
while (i*cw < w)
{
- getch(ch, cs);
- if (ch == '\12' || ch == UEOF) break;
- buff->addch(ch,cs);
- i++;
+ getch(ch, cs);
+ if (ch == '\12' || ch == UEOF) break;
+ buff->addch(ch,cs);
+ i++;
}
buff->truncate(i);
laststartline = exp->locate();
return (ch != UEOF);
@@ -163,55 +163,55 @@ int BuffDoc::openfile(QWidget* _parent, const char *src)
exp = new Aportis;
int ret = exp->openfile(src);
if (ret == -1)
{
- delete exp;
- exp = NULL;
- return ret;
+ delete exp;
+ exp = NULL;
+ return ret;
}
if (ret == -2)
{
- delete exp;
- exp = new ztxt;
- ret = exp->openfile(src);
+ delete exp;
+ exp = new ztxt;
+ ret = exp->openfile(src);
}
if (ret != 0)
{
- delete exp;
- exp = new CPlucker;
- ret = exp->openfile(src);
+ delete exp;
+ exp = new CPlucker;
+ ret = exp->openfile(src);
}
#ifndef SMALL
if (ret != 0)
{
- delete exp;
- qDebug("Trying ppms");
- exp = new ppm_expander;
- ret = exp->openfile(src);
+ delete exp;
+ qDebug("Trying ppms");
+ exp = new ppm_expander;
+ ret = exp->openfile(src);
}
-
+
if (ret != 0)
{
- delete exp;
- exp = new Text;
-// qDebug("Trying text");
- ret = exp->openfile(src);
+ delete exp;
+ exp = new Text;
+// qDebug("Trying text");
+ ret = exp->openfile(src);
}
#else
if (ret != 0)
{
- delete exp;
- exp = new Text;
- ret = exp->openfile(src);
+ delete exp;
+ exp = new Text;
+ ret = exp->openfile(src);
}
#endif
if (ret != 0)
{
- delete exp;
- QMessageBox::information(_parent, "QTReader", "Unknown file compression type","Try another file");
- return ret;
+ delete exp;
+ QMessageBox::information(_parent, "OpieReader", "Unknown file compression type","Try another file");
+ return ret;
}
// qDebug("Doing final open:%x:%x",exp,filt);
lastword.empty();
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp
index 0608b66..ef1f4f1 100644
--- a/noncore/apps/opie-reader/QTReaderApp.cpp
+++ b/noncore/apps/opie-reader/QTReaderApp.cpp
@@ -73,18 +73,18 @@ void QTReaderApp::listBkmkFiles()
d = opendir((const char *)Global::applicationFileName("uqtreader",""));
while(1)
{
- struct dirent* de;
- struct stat buf;
- de = readdir(d);
- if (de == NULL) break;
+ struct dirent* de;
+ struct stat buf;
+ de = readdir(d);
+ if (de == NULL) break;
- if (lstat((const char *)Global::applicationFileName("uqtreader",de->d_name),&buf) == 0 && S_ISREG(buf.st_mode))
- {
- bkmkselector->insertItem(de->d_name);
- cnt++;
- }
+ if (lstat((const char *)Global::applicationFileName("uqtreader",de->d_name),&buf) == 0 && S_ISREG(buf.st_mode))
+ {
+ bkmkselector->insertItem(de->d_name);
+ cnt++;
+ }
}
closedir(d);
@@ -94,13 +94,13 @@ void QTReaderApp::listBkmkFiles()
editBar->hide();
if (m_fontVisible) m_fontBar->hide();
if (regVisible) regBar->hide();
if (searchVisible) searchBar->hide();
- m_nRegAction = cRmBkmkFile;
+ m_nRegAction = cRmBkmkFile;
editorStack->raiseWidget( bkmkselector );
}
else
- QMessageBox::information(this, "QTReader", "No bookmark files");
+ QMessageBox::information(this, "OpieReader", "No bookmark files");
}
QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
: QMainWindow( parent, name, f ), bFromDocView( FALSE ), m_dontSave(false)
@@ -110,16 +110,16 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
pBkmklist = NULL;
doc = 0;
- m_fBkmksChanged = false;
+ m_fBkmksChanged = false;
QString lang = getenv( "LANG" );
- m_autogenstr = "^ *[A-Z].*[a-z] *$";
+ m_autogenstr = "^ *[A-Z].*[a-z] *$";
setToolBarsMovable( FALSE );
- setIcon( Resource::loadPixmap( "uqtreader" ) );
+ setIcon( Resource::loadPixmap( "opie-reader/uqtreader" ) );
QPEToolBar *bar = new QPEToolBar( this );
bar->setHorizontalStretchable( TRUE );
addToolBar(bar, "tool",QMainWindow::Top, true);
@@ -254,9 +254,9 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
connect(ag, SIGNAL( selected(QAction*) ), this, SLOT( buttonActionSelected(QAction*) ) );
- a = m_scrollButton = new QAction( tr( "Scroll" ), Resource::loadPixmap( "panel-arrow-down" ), QString::null, 0, this, 0, true );
+ a = m_scrollButton = new QAction( tr( "Scroll" ), Resource::loadPixmap( "opie-reader/panel-arrow-down" ), QString::null, 0, this, 0, true );
// connect( a, SIGNAL( activated() ), this, SLOT( autoScroll() ) );
a->setOn(false);
connect( a, SIGNAL( toggled(bool) ), this, SLOT( autoScroll(bool) ) );
file->insertSeparator();
@@ -536,12 +536,12 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
searchBar->setStretchableWidget( searchEdit );
#ifdef __ISEARCH
connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
- this, SLOT( search( const QString& ) ) );
+ this, SLOT( search( const QString& ) ) );
#else
connect( searchEdit, SIGNAL( returnPressed( ) ),
- this, SLOT( search( ) ) );
+ this, SLOT( search( ) ) );
#endif
a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) );
a->addTo( searchBar );
@@ -562,9 +562,9 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
regBar->setStretchableWidget( regEdit );
connect( regEdit, SIGNAL( returnPressed( ) ),
- this, SLOT( do_regaction() ) );
+ this, SLOT( do_regaction() ) );
a = new QAction( tr( "Do Reg" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) );
a->addTo( regBar );
@@ -581,39 +581,39 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
m_fontSelector = new QComboBox(false, m_fontBar);
m_fontBar->setStretchableWidget( m_fontSelector );
{
- FontDatabase f;
- QStringList flist = f.families();
- m_fontSelector->insertStringList(flist);
-
- bool realfont = false;
- for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++)
- {
- if (reader->m_fontname == *nm)
- {
- realfont = true;
- break;
- }
- }
- if (!realfont) reader->m_fontname = flist[0];
+ FontDatabase f;
+ QStringList flist = f.families();
+ m_fontSelector->insertStringList(flist);
+
+ bool realfont = false;
+ for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++)
+ {
+ if (reader->m_fontname == *nm)
+ {
+ realfont = true;
+ break;
+ }
+ }
+ if (!realfont) reader->m_fontname = flist[0];
} // delete the FontDatabase!!!
connect( m_fontSelector, SIGNAL( activated(const QString& ) ),
- this, SLOT( do_setfont(const QString&) ) );
+ this, SLOT( do_setfont(const QString&) ) );
m_fontBar->hide();
m_fontVisible = false;
connect(qApp, SIGNAL( appMessage(const QCString&, const QByteArray& ) ),
- this, SLOT( msgHandler(const QCString&, const QByteArray&) ) );
+ this, SLOT( msgHandler(const QCString&, const QByteArray&) ) );
reader->init();
if (!reader->m_lastfile.isEmpty())
{
- openFile( reader->m_lastfile );
- doc = new DocLnk(reader->m_lastfile);
+ openFile( reader->m_lastfile );
+ doc = new DocLnk(reader->m_lastfile);
}
m_EncodingAction[reader->m_encd]->setOn(true);
m_buttonAction[m_spaceTarget]->setOn(true);
do_setfont(reader->m_fontname);
@@ -627,261 +627,261 @@ void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data)
QDataStream stream( _data, IO_ReadOnly );
if ( msg == "info(QString)" )
{
- QString info;
- stream >> info;
- QMessageBox::information(this, "QTReader", info);
+ QString info;
+ stream >> info;
+ QMessageBox::information(this, "OpieReader", info);
}
else if ( msg == "warn(QString)" )
{
- QString info;
- stream >> info;
- QMessageBox::warning(this, "QTReader", info);
+ QString info;
+ stream >> info;
+ QMessageBox::warning(this, "OpieReader", info);
}
else if ( msg == "exit()" )
{
- m_dontSave = true;
- close();
+ m_dontSave = true;
+ close();
}
else if ( msg == "pageDown()" )
{
- reader->dopagedn();
+ reader->dopagedn();
}
else if ( msg == "pageUp()" )
{
- reader->dopageup();
+ reader->dopageup();
}
else if ( msg == "lineDown()" )
{
- reader->lineDown();
+ reader->lineDown();
}
else if ( msg == "lineUp()" )
{
- reader->lineUp();
+ reader->lineUp();
}
else if ( msg == "showText()" )
{
- showEditTools();
+ showEditTools();
}
else if ( msg == "File/Open(QString)" )
{
- QString info;
- stream >> info;
- openFile( info );
+ QString info;
+ stream >> info;
+ openFile( info );
}
else if ( msg == "File/Info()" )
{
- showinfo();
+ showinfo();
}
else if ( msg == "File/Start Block()" )
{
- editMark();
+ editMark();
}
else if ( msg == "File/Copy Block()" )
{
- editCopy();
+ editCopy();
}
else if ( msg == "File/Scroll(int)" )
{
- int info;
- stream >> info;
- autoScroll(info);
+ int info;
+ stream >> info;
+ autoScroll(info);
}
else if ( msg == "File/Jump(int)" )
{
- int info;
- stream >> info;
- reader->locate(info);
+ int info;
+ stream >> info;
+ reader->locate(info);
}
else if ( msg == "File/Page/Line Scroll(int)" )
{
- int info;
- stream >> info;
- pagemode(info);
+ int info;
+ stream >> info;
+ pagemode(info);
}
else if ( msg == "File/Set Overlap(int)" )
{
- int info;
- stream >> info;
- reader->m_overlap = info;
+ int info;
+ stream >> info;
+ reader->m_overlap = info;
}
else if ( msg == "File/Set Dictionary(QString)" )
{
- QString info;
- stream >> info;
- do_settarget(info);
+ QString info;
+ stream >> info;
+ do_settarget(info);
}
else if ( msg == "File/Two/One Touch(int)" )
{
- int info;
- stream >> info;
- setTwoTouch(info);
+ int info;
+ stream >> info;
+ setTwoTouch(info);
}
else if ( msg == "Target/Annotation(int)" )
{
- int info;
- stream >> info;
- OnAnnotation(info);
+ int info;
+ stream >> info;
+ OnAnnotation(info);
}
else if ( msg == "Target/Dictionary(int)" )
{
- int info;
- stream >> info;
- OnDictionary(info);
+ int info;
+ stream >> info;
+ OnDictionary(info);
}
else if ( msg == "Target/Clipboard(int)" )
{
- int info;
- stream >> info;
- OnClipboard(info);
+ int info;
+ stream >> info;
+ OnClipboard(info);
}
else if ( msg == "File/Find(QString)" )
{
- QString info;
- stream >> info;
- QRegExp arg(info);
- size_t pos = reader->pagelocate();
- size_t start = pos;
- CDrawBuffer test(&(reader->m_fontControl));
- reader->buffdoc.getline(&test,reader->width());
- while (arg.match(toQString(test.data())) == -1)
- {
- pos = reader->locate();
- if (!reader->buffdoc.getline(&test,reader->width()))
- {
- QMessageBox::information(this, "QTReader", QString("Can't find\n")+info);
- pos = start;
- break;
- }
- }
- reader->locate(pos);
+ QString info;
+ stream >> info;
+ QRegExp arg(info);
+ size_t pos = reader->pagelocate();
+ size_t start = pos;
+ CDrawBuffer test(&(reader->m_fontControl));
+ reader->buffdoc.getline(&test,reader->width());
+ while (arg.match(toQString(test.data())) == -1)
+ {
+ pos = reader->locate();
+ if (!reader->buffdoc.getline(&test,reader->width()))
+ {
+ QMessageBox::information(this, "OpieReader", QString("Can't find\n")+info);
+ pos = start;
+ break;
+ }
+ }
+ reader->locate(pos);
}
else if ( msg == "Layout/Strip CR(int)" )
{
- int info;
- stream >> info;
- stripcr(info);
+ int info;
+ stream >> info;
+ stripcr(info);
}
else if ( msg == "Markup/Auto(int)" )
{
- int info;
- stream >> info;
- autofmt(info);
+ int info;
+ stream >> info;
+ autofmt(info);
}
else if ( msg == "Markup/Text(int)" )
{
- int info;
- stream >> info;
- textfmt(info);
+ int info;
+ stream >> info;
+ textfmt(info);
}
else if ( msg == "Markup/HTML(int)" )
{
- int info;
- stream >> info;
- striphtml(info);
+ int info;
+ stream >> info;
+ striphtml(info);
}
else if ( msg == "Markup/Peanut(int)" )
{
- int info;
- stream >> info;
- peanut(info);
+ int info;
+ stream >> info;
+ peanut(info);
}
else if ( msg == "Layout/Dehyphen(int)" )
{
- int info;
- stream >> info;
- dehyphen(info);
+ int info;
+ stream >> info;
+ dehyphen(info);
}
else if ( msg == "Layout/Unindent(int)" )
{
- int info;
- stream >> info;
- unindent(info);
+ int info;
+ stream >> info;
+ unindent(info);
}
else if ( msg == "Layout/Re-paragraph(int)" )
{
- int info;
- stream >> info;
- repara(info);
+ int info;
+ stream >> info;
+ repara(info);
}
else if ( msg == "Layout/Double Space(int)" )
{
- int info;
- stream >> info;
- dblspce(info);
+ int info;
+ stream >> info;
+ dblspce(info);
}
else if ( msg == "Layout/Indent(int)" )
{
- int info;
- stream >> info;
- reader->bindenter = info;
- reader->setfilter(reader->getfilter());
+ int info;
+ stream >> info;
+ reader->bindenter = info;
+ reader->setfilter(reader->getfilter());
}
else if ( msg == "Layout/Remap(int)" )
{
- int info;
- stream >> info;
- remap(info);
+ int info;
+ stream >> info;
+ remap(info);
}
else if ( msg == "Layout/Embolden(int)" )
{
- int info;
- stream >> info;
- embolden(info);
+ int info;
+ stream >> info;
+ embolden(info);
}
else if ( msg == "Format/Ideogram/Word(int)" )
{
- int info;
- stream >> info;
- monospace(info);
+ int info;
+ stream >> info;
+ monospace(info);
}
else if ( msg == "Format/Set width(int)" )
{
- int info;
- stream >> info;
- reader->m_charpc = info;
- reader->setfont();
- reader->refresh();
+ int info;
+ stream >> info;
+ reader->m_charpc = info;
+ reader->setfont();
+ reader->refresh();
}
else if ( msg == "Format/Encoding(QString)" )
{
- QString info;
- stream >> info;
- reader->setencoding(EncNameToInt(info));
+ QString info;
+ stream >> info;
+ reader->setencoding(EncNameToInt(info));
}
else if ( msg == "Format/Set Font(QString,int)" )
{
- QString fontname;
- int size;
- stream >> fontname;
- stream >> size;
- setfontHelper(fontname, size);
+ QString fontname;
+ int size;
+ stream >> fontname;
+ stream >> size;
+ setfontHelper(fontname, size);
}
else if ( msg == "Marks/Autogen(QString)" )
{
- QString info;
- stream >> info;
- do_autogen(info);
+ QString info;
+ stream >> info;
+ do_autogen(info);
}
}
ActionTypes QTReaderApp::ActNameToInt(const QString& _enc)
{
for (int i = 0; i < MAX_ACTIONS; i++)
{
- if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i;
+ if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i;
}
return cesAutoScroll;
}
int QTReaderApp::EncNameToInt(const QString& _enc)
{
for (int i = 0; i < MAX_ENCODING; i++)
{
- if (m_EncodingAction[i]->text() == _enc) return i;
+ if (m_EncodingAction[i]->text() == _enc) return i;
}
return 0;
/*
if (_enc == "Ascii") return 0;
@@ -913,21 +913,21 @@ void QTReaderApp::autoScroll(bool _b)
}
void QTReaderApp::TBD()
{
- QMessageBox::information(this, "QTReader", "Not yet implemented", 1);
+ QMessageBox::information(this, "OpieReader", "Not yet implemented", 1);
}
void QTReaderApp::TBDzoom()
{
- QMessageBox::information(this, "QTReader", "Zooming is done interactively\nTry left/right cursor keys", 1);
+ QMessageBox::information(this, "OpieReader", "Zooming is done interactively\nTry left/right cursor keys", 1);
}
void QTReaderApp::clearBkmkList()
{
- delete pBkmklist;
- pBkmklist = NULL;
- m_fBkmksChanged = false;
+ delete pBkmklist;
+ pBkmklist = NULL;
+ m_fBkmksChanged = false;
}
void QTReaderApp::fileOpen()
{
@@ -938,32 +938,32 @@ void QTReaderApp::fileOpen()
if (searchVisible) searchBar->hide();
*/
if (pBkmklist != NULL)
{
- if (m_fBkmksChanged)
- {
- if (QMessageBox::warning(this, "QTReader", "Save bookmarks?", "Save", "Don't bother") == 0)
- savebkmks();
- }
- delete pBkmklist;
- pBkmklist = NULL;
- m_fBkmksChanged = false;
+ if (m_fBkmksChanged)
+ {
+ if (QMessageBox::warning(this, "OpieReader", "Save bookmarks?", "Save", "Don't bother") == 0)
+ savebkmks();
+ }
+ delete pBkmklist;
+ pBkmklist = NULL;
+ m_fBkmksChanged = false;
}
reader->disableAutoscroll();
/*
editorStack->raiseWidget( fileSelector );
fileSelector->reread();
*/
- fileBrowser* fb = new fileBrowser(this,"QTReader",TRUE,
- 0,
-// WStyle_Customize | WStyle_NoBorderEx,
- "*", QFileInfo(reader->m_lastfile).dirPath(true));
+ fileBrowser* fb = new fileBrowser(this,"OpieReader",TRUE,
+ 0,
+// WStyle_Customize | WStyle_NoBorderEx,
+ "*", QFileInfo(reader->m_lastfile).dirPath(true));
if (fb->exec())
{
- QString fn(fb->fileList[0]);
+ QString fn(fb->fileList[0]);
// fb->populateList();
- if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn);
+ if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn);
}
delete fb;
reader->setFocus();
}
@@ -972,21 +972,21 @@ void QTReaderApp::showinfo()
{
unsigned long fs, ts, pl;
if (reader->empty())
{
- QMessageBox::information(this, "QTReader", "No file loaded", 1);
+ QMessageBox::information(this, "OpieReader", "No file loaded", 1);
}
else
{
- reader->sizes(fs,ts);
- pl = reader->pagelocate();
- m_infoWin->setFileSize(fs);
- m_infoWin->setTextSize(ts);
- m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts);
- m_infoWin->setLocation(pl);
- m_infoWin->setRead((100*pl + (ts >> 1))/ts);
- editorStack->raiseWidget( m_infoWin );
- m_infoWin->setFocus();
+ reader->sizes(fs,ts);
+ pl = reader->pagelocate();
+ m_infoWin->setFileSize(fs);
+ m_infoWin->setTextSize(ts);
+ m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts);
+ m_infoWin->setLocation(pl);
+ m_infoWin->setRead((100*pl + (ts >> 1))/ts);
+ editorStack->raiseWidget( m_infoWin );
+ m_infoWin->setFocus();
}
}
void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn)
@@ -996,15 +996,15 @@ void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn)
CBuffer buff(name.length()+1);
int i;
for (i = 0; i < name.length(); i++)
{
- buff[i] = name[i].unicode();
+ buff[i] = name[i].unicode();
}
buff[i] = 0;
CBuffer buff2(text.length()+1);
for (i = 0; i < text.length(); i++)
{
- buff2[i] = text[i].unicode();
+ buff2[i] = text[i].unicode();
}
buff2[i] = 0;
pBkmklist->push_front(Bkmk(buff.data(), buff2.data(), posn));
#else
@@ -1017,77 +1017,77 @@ void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn)
void QTReaderApp::addAnno(const QString& name, const QString& text)
{
if (m_annoIsEditing)
{
- if (name.isEmpty())
- {
- QMessageBox::information(this, "QTReader", "Need a name for the bookmark\nPlease try again", 1);
- }
- else
- {
- addAnno(name, text, m_annoWin->getPosn());
- }
- showEditTools();
+ if (name.isEmpty())
+ {
+ QMessageBox::information(this, "OpieReader", "Need a name for the bookmark\nPlease try again", 1);
+ }
+ else
+ {
+ addAnno(name, text, m_annoWin->getPosn());
+ }
+ showEditTools();
}
else
{
- if (m_annoWin->edited())
- {
- CBuffer buff(text.length()+1);
- int i;
- for (i = 0; i < text.length(); i++)
- {
- buff[i] = text[i].unicode();
- }
- buff[i] = 0;
- m_fBkmksChanged = true;
- m_anno->setAnno(buff.data());
- }
- bool found = findNextBookmark(m_anno->value()+1);
- if (found)
- {
- m_annoWin->setName(toQString(m_anno->name()));
- m_annoWin->setAnno(toQString(m_anno->anno()));
- }
- else
- {
- showEditTools();
- }
+ if (m_annoWin->edited())
+ {
+ CBuffer buff(text.length()+1);
+ int i;
+ for (i = 0; i < text.length(); i++)
+ {
+ buff[i] = text[i].unicode();
+ }
+ buff[i] = 0;
+ m_fBkmksChanged = true;
+ m_anno->setAnno(buff.data());
+ }
+ bool found = findNextBookmark(m_anno->value()+1);
+ if (found)
+ {
+ m_annoWin->setName(toQString(m_anno->name()));
+ m_annoWin->setAnno(toQString(m_anno->anno()));
+ }
+ else
+ {
+ showEditTools();
+ }
}
}
bool QTReaderApp::findNextBookmark(size_t start)
{
bool found = false;
for (CList<Bkmk>::iterator iter = pBkmklist->begin(); iter != pBkmklist->end(); iter++)
{
- if (iter->value() >= start)
- {
- if (iter->value() < reader->locate())
- {
- found = true;
- m_anno = iter.pContent();
- }
- break;
- }
+ if (iter->value() >= start)
+ {
+ if (iter->value() < reader->locate())
+ {
+ found = true;
+ m_anno = iter.pContent();
+ }
+ break;
+ }
}
return found;
}
void QTReaderApp::addanno()
{
if (reader->empty())
{
- QMessageBox::information(this, "QTReader", "No file loaded", 1);
+ QMessageBox::information(this, "OpieReader", "No file loaded", 1);
}
else
{
- m_annoWin->setName("");
- m_annoWin->setAnno("");
- m_annoWin->setPosn(reader->pagelocate());
- m_annoIsEditing = true;
- editorStack->raiseWidget( m_annoWin );
- m_annoWin->setFocus();
+ m_annoWin->setName("");
+ m_annoWin->setAnno("");
+ m_annoWin->setPosn(reader->pagelocate());
+ m_annoIsEditing = true;
+ editorStack->raiseWidget( m_annoWin );
+ m_annoWin->setFocus();
}
}
void QTReaderApp::infoClose()
@@ -1115,20 +1115,20 @@ void QTReaderApp::editMark()
}
void QTReaderApp::editCopy()
{
- QClipboard* cb = QApplication::clipboard();
- QString text;
- int ch;
- unsigned long currentpos = reader->pagelocate();
- unsigned long endpos = reader->locate();
- reader->jumpto(m_savedpos);
- while (reader->explocate() < endpos && (ch = reader->getch()) != UEOF)
- {
- text += ch;
- }
- cb->setText(text);
- reader->locate(currentpos);
+ QClipboard* cb = QApplication::clipboard();
+ QString text;
+ int ch;
+ unsigned long currentpos = reader->pagelocate();
+ unsigned long endpos = reader->locate();
+ reader->jumpto(m_savedpos);
+ while (reader->explocate() < endpos && (ch = reader->getch()) != UEOF)
+ {
+ text += ch;
+ }
+ cb->setText(text);
+ reader->locate(currentpos);
}
void QTReaderApp::pageup()
{
@@ -1215,10 +1215,10 @@ void QTReaderApp::setoverlap()
void QTReaderApp::settarget()
{
m_nRegAction = cSetTarget;
QString text = ((m_targetapp.isEmpty()) ? QString("") : m_targetapp)
- + "/"
- + ((m_targetmsg.isEmpty()) ? QString("") : m_targetmsg);
+ + "/"
+ + ((m_targetmsg.isEmpty()) ? QString("") : m_targetmsg);
regEdit->setText(text);
do_regedit();
}
@@ -1227,27 +1227,27 @@ void QTReaderApp::do_overlap(const QString& lcn)
bool ok;
unsigned long ulcn = lcn.toULong(&ok);
if (ok)
{
- reader->m_overlap = ulcn;
+ reader->m_overlap = ulcn;
}
else
- QMessageBox::information(this, "QTReader", "Must be a number");
+ QMessageBox::information(this, "OpieReader", "Must be a number");
}
void QTReaderApp::do_mono(const QString& lcn)
{
bool ok;
unsigned long ulcn = lcn.toULong(&ok);
if (ok)
{
- reader->m_charpc = ulcn;
- reader->setfont();
- reader->refresh();
-// reader->setmono(true);
+ reader->m_charpc = ulcn;
+ reader->setfont();
+ reader->refresh();
+// reader->setmono(true);
}
else
- QMessageBox::information(this, "QTReader", "Must be a number");
+ QMessageBox::information(this, "OpieReader", "Must be a number");
}
/*
void QTReaderApp::editPaste()
@@ -1331,17 +1331,17 @@ bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg)
#endif
{
pos = reader->locate();
if (!reader->buffdoc.getline(&test,reader->width()))
- {
- if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2)
- pos = searchStart;
- else
- pos = start;
- ret = false;
- findClose();
- break;
- }
+ {
+ if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2)
+ pos = searchStart;
+ else
+ pos = start;
+ ret = false;
+ findClose();
+ break;
+ }
}
reader->locate(pos);
return ret;
}
@@ -1417,24 +1417,24 @@ void QTReaderApp::openFile( const DocLnk &f )
readbkmks();
}
else
{
- QMessageBox::information(this, "QTReader", "File does not exist");
+ QMessageBox::information(this, "OpieReader", "File does not exist");
}
-
+
}
void QTReaderApp::showEditTools()
{
if ( !doc )
- close();
+ close();
// fileSelector->hide();
//tjw menu->show();
editBar->show();
if ( searchVisible )
- searchBar->show();
+ searchBar->show();
if ( regVisible )
- regBar->show();
+ regBar->show();
if (m_fontVisible) m_fontBar->show();
updateCaption();
editorStack->raiseWidget( reader );
@@ -1443,29 +1443,29 @@ void QTReaderApp::showEditTools()
/*
void QTReaderApp::save()
{
if ( !doc )
- return;
+ return;
if ( !editor->edited() )
- return;
+ return;
QString rt = editor->text();
QString pt = rt;
if ( doc->name().isEmpty() ) {
- unsigned ispace = pt.find( ' ' );
- unsigned ienter = pt.find( '\n' );
- int i = (ispace < ienter) ? ispace : ienter;
- QString docname;
- if ( i == -1 ) {
- if ( pt.isEmpty() )
- docname = "Empty Text";
- else
- docname = pt;
- } else {
- docname = pt.left( i );
- }
- doc->setName(docname);
+ unsigned ispace = pt.find( ' ' );
+ unsigned ienter = pt.find( '\n' );
+ int i = (ispace < ienter) ? ispace : ienter;
+ QString docname;
+ if ( i == -1 ) {
+ if ( pt.isEmpty() )
+ docname = "Empty Text";
+ else
+ docname = pt;
+ } else {
+ docname = pt.left( i );
+ }
+ doc->setName(docname);
}
FileManager fm;
fm.saveFile( *doc, rt );
}
@@ -1475,24 +1475,24 @@ void QTReaderApp::clear()
{
if (doc != 0)
{
// QMessageBox::information(this, "QTReader", "Deleting doc", 1);
- delete doc;
+ delete doc;
// QMessageBox::information(this, "QTReader", "Deleted doc", 1);
- doc = 0;
+ doc = 0;
}
reader->clear();
}
void QTReaderApp::updateCaption()
{
if ( !doc )
- setCaption( tr("QTReader") );
+ setCaption( tr("OpieReader") );
else {
- QString s = doc->name();
- if ( s.isEmpty() )
- s = tr( "Unnamed" );
- setCaption( s + " - " + tr("QTReader") );
+ QString s = doc->name();
+ if ( s.isEmpty() )
+ s = tr( "Unnamed" );
+ setCaption( s + " - " + tr("OpieReader") );
}
}
void QTReaderApp::setDocument(const QString& fileref)
@@ -1506,47 +1506,47 @@ void QTReaderApp::setDocument(const QString& fileref)
void QTReaderApp::closeEvent( QCloseEvent *e )
{
if (m_dontSave)
{
- e->accept();
+ e->accept();
}
else
{
- if (editorStack->visibleWidget() == reader)
- {
- if (m_fontVisible)
- {
- m_fontBar->hide();
- m_fontVisible = false;
- }
- if (regVisible)
- {
- regBar->hide();
- regVisible = false;
- return;
- }
- if (searchVisible)
- {
- searchBar->hide();
- searchVisible = false;
- return;
- }
- if (m_fBkmksChanged && pBkmklist != NULL)
- {
- if (QMessageBox::warning(this, "QTReader", "Save bookmarks?", "Save", "Don't bother") == 0)
- savebkmks();
- delete pBkmklist;
- pBkmklist = NULL;
- m_fBkmksChanged = false;
- }
- bFromDocView = FALSE;
- saveprefs();
- e->accept();
- }
- else
- {
- showEditTools();
- }
+ if (editorStack->visibleWidget() == reader)
+ {
+ if (m_fontVisible)
+ {
+ m_fontBar->hide();
+ m_fontVisible = false;
+ }
+ if (regVisible)
+ {
+ regBar->hide();
+ regVisible = false;
+ return;
+ }
+ if (searchVisible)
+ {
+ searchBar->hide();
+ searchVisible = false;
+ return;
+ }
+ if (m_fBkmksChanged && pBkmklist != NULL)
+ {
+ if (QMessageBox::warning(this, "OpieReader", "Save bookmarks?", "Save", "Don't bother") == 0)
+ savebkmks();
+ delete pBkmklist;
+ pBkmklist = NULL;
+ m_fBkmksChanged = false;
+ }
+ bFromDocView = FALSE;
+ saveprefs();
+ e->accept();
+ }
+ else
+ {
+ showEditTools();
+ }
}
}
void QTReaderApp::do_gotomark()
@@ -1566,17 +1566,17 @@ void QTReaderApp::listbkmk()
bkmkselector->clear();
int cnt = 0;
if (pBkmklist != NULL)
{
- for (CList<Bkmk>::iterator i = pBkmklist->begin(); i != pBkmklist->end(); i++)
- {
+ for (CList<Bkmk>::iterator i = pBkmklist->begin(); i != pBkmklist->end(); i++)
+ {
#ifdef _UNICODE
- bkmkselector->insertItem(toQString(i->name()));
+ bkmkselector->insertItem(toQString(i->name()));
#else
- bkmkselector->insertItem(i->name());
+ bkmkselector->insertItem(i->name());
#endif
- cnt++;
- }
+ cnt++;
+ }
}
if (cnt > 0)
{
//tjw menu->hide();
@@ -1586,9 +1586,9 @@ void QTReaderApp::listbkmk()
if (searchVisible) searchBar->hide();
editorStack->raiseWidget( bkmkselector );
}
else
- QMessageBox::information(this, "QTReader", "No bookmarks in memory");
+ QMessageBox::information(this, "OpieReader", "No bookmarks in memory");
}
void QTReaderApp::do_autogen()
{
@@ -1608,20 +1608,20 @@ void QTReaderApp::do_regedit()
void QTReaderApp::gotobkmk(int ind)
{
switch (m_nRegAction)
{
- case cGotoBkmk:
- reader->locate((*pBkmklist)[ind]->value());
- break;
- case cDelBkmk:
-// qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name());
- pBkmklist->erase(ind);
- m_fBkmksChanged = true;
-// pBkmklist->sort();
- break;
- case cRmBkmkFile:
- unlink((const char *)Global::applicationFileName("uqtreader",bkmkselector->text(ind)));
- break;
+ case cGotoBkmk:
+ reader->locate((*pBkmklist)[ind]->value());
+ break;
+ case cDelBkmk:
+// qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name());
+ pBkmklist->erase(ind);
+ m_fBkmksChanged = true;
+// pBkmklist->sort();
+ break;
+ case cRmBkmkFile:
+ unlink((const char *)Global::applicationFileName("uqtreader",bkmkselector->text(ind)));
+ break;
}
showEditTools();
}
@@ -1643,11 +1643,11 @@ void QTReaderApp::do_jump(const QString& lcn)
{
bool ok;
unsigned long ulcn = lcn.toULong(&ok);
if (ok)
- reader->locate(ulcn);
+ reader->locate(ulcn);
else
- QMessageBox::information(this, "QTReader", "Must be a number");
+ QMessageBox::information(this, "OpieReader", "Must be a number");
}
void QTReaderApp::do_regaction()
{
@@ -1655,25 +1655,25 @@ void QTReaderApp::do_regaction()
regVisible = false;
switch(m_nRegAction)
{
case cAutoGen:
- do_autogen(regEdit->text());
- break;
+ do_autogen(regEdit->text());
+ break;
case cAddBkmk:
- do_addbkmk(regEdit->text());
- break;
+ do_addbkmk(regEdit->text());
+ break;
case cJump:
- do_jump(regEdit->text());
- break;
+ do_jump(regEdit->text());
+ break;
case cMonoSpace:
- do_mono(regEdit->text());
- break;
+ do_mono(regEdit->text());
+ break;
case cOverlap:
- do_overlap(regEdit->text());
- break;
+ do_overlap(regEdit->text());
+ break;
case cSetTarget:
- do_settarget(regEdit->text());
- break;
+ do_settarget(regEdit->text());
+ break;
}
reader->restore();
// editBar->show();
reader->setFocus();
@@ -1683,28 +1683,28 @@ void QTReaderApp::do_settarget(const QString& _txt)
{
int ind = _txt.find('/');
if (ind == -1)
{
- m_targetapp = "";
- m_targetmsg = "";
- QMessageBox::information(this, "QTReader", "Format is\nappname/messagename");
+ m_targetapp = "";
+ m_targetmsg = "";
+ QMessageBox::information(this, "OpieReader", "Format is\nappname/messagename");
}
else
{
- m_targetapp = _txt.left(ind);
- m_targetmsg = _txt.right(_txt.length()-ind-1);
+ m_targetapp = _txt.left(ind);
+ m_targetmsg = _txt.right(_txt.length()-ind-1);
}
}
void QTReaderApp::setfont()
{
for (int i = 1; i <= m_fontSelector->count(); i++)
{
- if (m_fontSelector->text(i) == reader->m_fontname)
- {
- m_fontSelector->setCurrentItem(i);
- break;
- }
+ if (m_fontSelector->text(i) == reader->m_fontname)
+ {
+ m_fontSelector->setCurrentItem(i);
+ break;
+ }
}
m_fontBar->show();
m_fontVisible = true;
}
@@ -1719,9 +1719,9 @@ void QTReaderApp::setfontHelper(const QString& lcn, int size = 0)
m_annoWin->setFont( f );
reader->m_fontname = lcn;
if (!reader->ChangeFont(size))
{
- reader->ChangeFont(size);
+ reader->ChangeFont(size);
}
reader->refresh();
m_fontBar->hide();
m_fontVisible = false;
@@ -1758,20 +1758,20 @@ pbar->resize(width(), editBar->height());
int pc = (100*lcn)/ts;
if (pc != lastpc)
{
pbar->setProgress(pc);
- qApp->processEvents();
- if (reader->locate() != lcn) reader->jumpto(lcn);
- reader->setFocus();
+ 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));
+ pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn));
}
pBkmklist->sort();
pbar->setProgress(100);
qApp->processEvents();
@@ -1843,42 +1843,42 @@ void info_cb(Fl_Widget* o, void* _data)
{
if (infowin == NULL)
{
-
- infowin = new Fl_Window(160,240);
- filename = new Fl_Output(45,5,110,14,"Filename");
- filesize = new Fl_Output(45,25,110,14,"Filesize");
- textsize = new Fl_Output(45,45,110,14,"Textsize");
- comprat = new CBar(45,65,110,14,"Ratio %");
- posn = new Fl_Output(45,85,110,14,"Location");
- frcn = new CBar(45,105,110,14,"% Read");
- about = new Fl_Multiline_Output(5,125,150,90);
- about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files");
- Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay");
- infowin->set_modal();
+
+ infowin = new Fl_Window(160,240);
+ filename = new Fl_Output(45,5,110,14,"Filename");
+ filesize = new Fl_Output(45,25,110,14,"Filesize");
+ textsize = new Fl_Output(45,45,110,14,"Textsize");
+ comprat = new CBar(45,65,110,14,"Ratio %");
+ posn = new Fl_Output(45,85,110,14,"Location");
+ frcn = new CBar(45,105,110,14,"% Read");
+ about = new Fl_Multiline_Output(5,125,150,90);
+ about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files");
+ Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay");
+ infowin->set_modal();
}
if (((reader_ui *)_data)->g_filename[0] != '\0')
{
- unsigned long fs,ts;
- tchar sz[20];
- ((reader_ui *)_data)->input->sizes(fs,ts);
- unsigned long pl = ((reader_ui *)_data)->input->locate();
+ unsigned long fs,ts;
+ tchar sz[20];
+ ((reader_ui *)_data)->input->sizes(fs,ts);
+ unsigned long pl = ((reader_ui *)_data)->input->locate();
- filename->value(((reader_ui *)_data)->g_filename);
+ filename->value(((reader_ui *)_data)->g_filename);
- sprintf(sz,"%u",fs);
- filesize->value(sz);
+ sprintf(sz,"%u",fs);
+ filesize->value(sz);
- sprintf(sz,"%u",ts);
- textsize->value(sz);
+ sprintf(sz,"%u",ts);
+ textsize->value(sz);
- comprat->value(100-(100*fs + (ts >> 1))/ts);
+ comprat->value(100-(100*fs + (ts >> 1))/ts);
- sprintf(sz,"%u",pl);
- posn->value(sz);
+ sprintf(sz,"%u",pl);
+ posn->value(sz);
- frcn->value((100*pl + (ts >> 1))/ts);
+ frcn->value((100*pl + (ts >> 1))/ts);
}
infowin->show();
}
*/
@@ -1886,29 +1886,29 @@ void info_cb(Fl_Widget* o, void* _data)
void QTReaderApp::savebkmks()
{
if (pBkmklist != NULL)
{
- BkmkFile bf((const char *)Global::applicationFileName("uqtreader",reader->m_string), true);
- bf.write(*pBkmklist);
+ BkmkFile bf((const char *)Global::applicationFileName("uqtreader",reader->m_string), true);
+ bf.write(*pBkmklist);
}
- m_fBkmksChanged = false;
+ m_fBkmksChanged = false;
}
void QTReaderApp::readbkmks()
{
if (pBkmklist != NULL)
{
- delete pBkmklist;
+ delete pBkmklist;
}
BkmkFile bf((const char *)Global::applicationFileName("uqtreader",reader->m_string));
pBkmklist = bf.readall();
m_fBkmksChanged = bf.upgraded();
if (pBkmklist == NULL)
{
- pBkmklist = reader->getbkmklist();
+ pBkmklist = reader->getbkmklist();
}
if (pBkmklist != NULL)
- pBkmklist->sort();
+ pBkmklist->sort();
}
void QTReaderApp::addbkmk()
{
@@ -1918,38 +1918,38 @@ void QTReaderApp::addbkmk()
}
void QTReaderApp::do_addbkmk(const QString& text)
{
- if (text.isEmpty())
- {
- QMessageBox::information(this, "QTReader", "Need a name for the bookmark\nSelect add again", 1);
- }
- else
- {
- if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>;
+ if (text.isEmpty())
+ {
+ QMessageBox::information(this, "OpieReader", "Need a name for the bookmark\nSelect add again", 1);
+ }
+ else
+ {
+ if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>;
#ifdef _UNICODE
- CBuffer buff;
- int i = 0;
- for (i = 0; i < text.length(); i++)
- {
- buff[i] = text[i].unicode();
- }
- buff[i] = 0;
- pBkmklist->push_front(Bkmk(buff.data(), NULL, reader->pagelocate()));
+ CBuffer buff;
+ int i = 0;
+ for (i = 0; i < text.length(); i++)
+ {
+ buff[i] = text[i].unicode();
+ }
+ buff[i] = 0;
+ pBkmklist->push_front(Bkmk(buff.data(), NULL, reader->pagelocate()));
#else
- pBkmklist->push_front(Bkmk((const tchar*)text,reader->pagelocate()));
+ pBkmklist->push_front(Bkmk((const tchar*)text,reader->pagelocate()));
#endif
- m_fBkmksChanged = true;
- pBkmklist->sort();
- }
+ m_fBkmksChanged = true;
+ pBkmklist->sort();
+ }
}
void QTReaderApp::OnRedraw()
{
if (pBkmklist != NULL)
{
- bool found = findNextBookmark(reader->pagelocate());
- m_bkmkAvail->setEnabled(found);
+ bool found = findNextBookmark(reader->pagelocate());
+ m_bkmkAvail->setEnabled(found);
}
}
void QTReaderApp::showAnnotation()
@@ -1966,63 +1966,63 @@ void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, const QString&
// qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd);
if (m_doClipboard)
{
- QClipboard* cb = QApplication::clipboard();
- cb->setText(wrd);
- if (wrd.length() > 10)
- {
- Global::statusMessage(wrd.left(8) + "..");
- }
- else
- {
- Global::statusMessage(wrd);
- }
+ QClipboard* cb = QApplication::clipboard();
+ cb->setText(wrd);
+ if (wrd.length() > 10)
+ {
+ Global::statusMessage(wrd.left(8) + "..");
+ }
+ else
+ {
+ Global::statusMessage(wrd);
+ }
}
if (m_doAnnotation)
{
-// addAnno(wrd, "Need to be able to edit this", posn);
- m_annoWin->setName(line);
- m_annoWin->setAnno("");
- m_annoWin->setPosn(posn);
- m_annoIsEditing = true;
- editorStack->raiseWidget( m_annoWin );
+// addAnno(wrd, "Need to be able to edit this", posn);
+ m_annoWin->setName(line);
+ m_annoWin->setAnno("");
+ m_annoWin->setPosn(posn);
+ m_annoIsEditing = true;
+ editorStack->raiseWidget( m_annoWin );
}
if (m_doDictionary)
{
- if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty())
- {
- QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8());
- e << wrd;
- }
+ if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty())
+ {
+ QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8());
+ e << wrd;
+ }
}
}
void QTReaderApp::OnActionPressed()
{
switch (m_spaceTarget)
{
- case cesOpenFile:
- {
- fileOpen();
- }
- break;
- case cesAutoScroll:
- {
- reader->setautoscroll(!reader->m_autoScroll);
- setScrollState(reader->m_autoScroll);
- }
- break;
- case cesActionMark:
- {
- addbkmk();
- }
- break;
- default:
- {
- qDebug("Unknown ActionType:%u", m_spaceTarget);
- }
- break;
+ case cesOpenFile:
+ {
+ fileOpen();
+ }
+ break;
+ case cesAutoScroll:
+ {
+ reader->setautoscroll(!reader->m_autoScroll);
+ setScrollState(reader->m_autoScroll);
+ }
+ break;
+ case cesActionMark:
+ {
+ addbkmk();
+ }
+ break;
+ default:
+ {
+ qDebug("Unknown ActionType:%u", m_spaceTarget);
+ }
+ break;
}
}
void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); }