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.cpp279
1 files changed, 140 insertions, 139 deletions
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp
index b072854..f18cb59 100644
--- a/noncore/apps/opie-reader/QTReaderApp.cpp
+++ b/noncore/apps/opie-reader/QTReaderApp.cpp
@@ -14,78 +14,79 @@
** 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 "useqpe.h"
-#include <qregexp.h>
-#include <qclipboard.h>
-#include <qwidgetstack.h>
+#include "QTReader.h"
+#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 "QTReaderApp.h"
+#include "CDrawBuffer.h"
+#include "Filedata.h"
+#include "opie.h"
+#include "names.h"
+#include "CEncoding_tables.h"
+#include "CloseDialog.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+#ifdef USEQPE
+#include <qpe/menubutton.h>
+#include <qpe/fontdatabase.h>
+#include <qpe/global.h>
+#include <qpe/applnk.h>
+#include <qpe/config.h>
+#include <qpe/qcopenvelope_qws.h>
+#endif
+
+/* QT */
#ifdef USEQPE
#include <qmenubar.h>
#include <qtoolbar.h>
#endif
+#include <qregexp.h>
+#include <qclipboard.h>
+#include <qwidgetstack.h>
#include <qmenubar.h>
#include <qtoolbar.h>
-#ifdef USEQPE
-#include <qpe/menubutton.h>
-#include <qpe/fontdatabase.h>
-#endif
#include <qcombobox.h>
#include <qpopupmenu.h>
#include <qaction.h>
#include <qapplication.h>
#include <qlineedit.h>
#include <qtoolbutton.h>
#include <qspinbox.h>
#include <qobjectlist.h>
-#ifdef USEQPE
-#include <qpe/global.h>
-#include <qpe/applnk.h>
-#endif
#include <qfileinfo.h>
-#include <stdlib.h> //getenv
#include <qprogressbar.h>
-#ifdef USEQPE
-#include <qpe/config.h>
-#endif
#include <qbuttongroup.h>
#include <qradiobutton.h>
-#ifdef USEQPE
-#include <qpe/qcopenvelope_qws.h>
-#endif
-#include "QTReader.h"
-#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 <qpe/fontdatabase.h>
+
+/* STD */
+#include <stdlib.h> //getenv
+
#ifdef USEQPE
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include "fileBrowser.h"
#else
#include "qfiledialog.h"
#endif
-#include "QTReaderApp.h"
-#include "CDrawBuffer.h"
-#include "Filedata.h"
-#include "opie.h"
-#include "names.h"
-#include "CEncoding_tables.h"
-#include "CloseDialog.h"
-
bool CheckVersion(int&, int&, char&);
#ifdef _WINDOWS
#define PICDIR "c:\\uqtreader\\pics\\"
#else
#ifdef USEQPE
@@ -122,13 +123,13 @@ void QTReaderApp::listBkmkFiles()
bkmkselector->setText("Cancel");
#ifndef USEQPE
int cnt = 0;
QDir d = QDir::home(); // "/"
if ( !d.cd(APPDIR) ) { // "/tmp"
- qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
+ owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl;
d = QDir::home();
d.mkdir(APPDIR);
d.cd(APPDIR);
}
@@ -143,13 +144,13 @@ void QTReaderApp::listBkmkFiles()
while ( (fi=it.current()) ) { // for each file...
bkmkselector->insertItem(fi->fileName());
cnt++;
- //qDebug( "%10li %s", fi->size(), fi->fileName().data() );
+ //odebug << "" << fi->size() << " " << fi->fileName().data() << "" << oendl;
++it; // goto next list element
}
#else /* USEQPE */
int cnt = 0;
DIR *d;
@@ -211,14 +212,14 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL)
{
m_url_clipboard = false;
m_url_localfile = false;
m_url_globalfile = false;
ftime(&m_lastkeytime);
-//// qDebug("Application directory = %s", (const tchar *)QPEApplication::documentDir());
-//// qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml"));
+//// odebug << "Application directory = " << (const tchar *)QPEApplication::documentDir() << "" << oendl;
+//// odebug << "Application directory = " << (const tchar *)Global::applicationFileName("uqtreader" << "" << oendl;
m_bcloseDisabled = true;
m_disableesckey = false;
pBkmklist = NULL;
pOpenlist = NULL;
// doc = 0;
@@ -240,13 +241,13 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
}
else if (rot.contains("Rot270"))
{
m_rot = 270;
}
-// qDebug("Initial Rotation(%d):%s", m_rot, (const char*)rot);
+// odebug << "Initial Rotation(" << m_rot << "):" << rot << "" << oendl;
*/
m_autogenstr = "^ *[A-Z].*[a-z] *$";
#ifdef USEQPE
setIcon( Resource::loadPixmap( PICDIR "uqtreader") );
#else
@@ -257,19 +258,19 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
// menubar = new QToolBar( this );
#ifdef USEQPE
Config config( APPDIR );
#else
QDir d = QDir::home(); // "/"
if ( !d.cd(APPDIR) ) { // "/tmp"
- qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
+ owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl;
d = QDir::home();
d.mkdir(APPDIR);
d.cd(APPDIR);
}
QFileInfo fi(d, INIFILE);
-// qDebug("Path:%s", (const char*)fi.absFilePath());
+// odebug << "Path:" << fi.absFilePath() << "" << oendl;
Config config(fi.absFilePath());
#endif
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);
@@ -353,24 +354,24 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
editorStack->addWidget( importSelector, get_unique_id() );
// don't need the close visible, it is redundant...
importSelector->setCloseVisible( FALSE );
*/
-// qDebug("Reading file list");
+// odebug << "Reading file list" << oendl;
readfilelist();
reader = new QTReader( editorStack );
reader->bDoUpdates = false;
#ifdef USEQPE
((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold);
#endif
-// qDebug("Reading config");
+// odebug << "Reading config" << oendl;
// Config config( APPDIR );
config.setGroup( "View" );
m_debounce = config.readNumEntry("Debounce", 0);
#ifdef USEQPE
m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false);
#else
@@ -766,13 +767,13 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
regBar->hide();
m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE );
m_fontBar->setHorizontalStretchable( TRUE );
-// qDebug("Font selector");
+// odebug << "Font selector" << oendl;
m_fontSelector = new QComboBox(false, m_fontBar);
m_fontBar->setStretchableWidget( m_fontSelector );
{
#ifndef USEQPE
QFontDatabase f;
#else
@@ -798,23 +799,23 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
m_fontBar->hide();
m_fontVisible = false;
#ifdef USEMSGS
connect(qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
this, SLOT( msgHandler(const QCString&,const QByteArray&) ) );
#endif
-// qDebug("Initing");
+// odebug << "Initing" << oendl;
reader->init();
-// qDebug("Inited");
+// odebug << "Inited" << oendl;
// m_buttonAction[m_spaceTarget]->setOn(true);
-// qDebug("fonting");
+// odebug << "fonting" << oendl;
do_setfont(reader->m_fontname);
if (!reader->m_lastfile.isEmpty())
{
-// qDebug("doclnk");
+// odebug << "doclnk" << oendl;
// doc = new DocLnk(reader->m_lastfile);
-// qDebug("doclnk done");
+// odebug << "doclnk done" << oendl;
if (pOpenlist != NULL)
{
/*
int ind = 0;
Bkmk* p = (*pOpenlist)[ind];
@@ -828,30 +829,30 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
{
p = iter.pContent();
if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile)
{
break;
}
-// qDebug("Item:%s", (const char*)toQString(CFiledata(p->anno()).name()));
+// odebug << "Item:" << toQString(CFiledata(p->anno()).name()) << "" << oendl;
p = NULL;
}
if (p != NULL)
{
-// qDebug("openfrombkmk");
+// odebug << "openfrombkmk" << oendl;
if (!openfrombkmk(p))
showEditTools();
}
else
{
-// qDebug("openfile");
+// odebug << "openfile" << oendl;
openFile( reader->m_lastfile );
}
}
else
{
-// qDebug("Openfile 2");
+// odebug << "Openfile 2" << oendl;
if (!reader->m_lastfile.isEmpty())
openFile( reader->m_lastfile );
}
}
else
{
@@ -867,13 +868,13 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
if (CheckVersion(major, bkmktype, minor))
{
config.writeEntry("Major", major);
config.writeEntry("BkmkType", bkmktype);
config.writeEntry("Minor", (int)minor);
}
-// qDebug("finished update");
+// odebug << "finished update" << oendl;
}
void QTReaderApp::addtoolbars(Config* config)
{
config->setGroup("Toolbar");
@@ -1025,20 +1026,20 @@ QToolBar* QTReaderApp::filebar()
{
if (fileBar == NULL)
{
switch (m_tbpol)
{
case cesSingle:
-// qDebug("Setting filebar to menubar");
+// odebug << "Setting filebar to menubar" << oendl;
fileBar = menubar;
break;
default:
- qDebug("Incorrect toolbar policy set");
+ odebug << "Incorrect toolbar policy set" << oendl;
case cesMenuTool:
case cesMultiple:
-// qDebug("Creating new file bar");
+// odebug << "Creating new file bar" << oendl;
fileBar = new QToolBar("File", this, m_tbposition);
break;
}
// fileBar->setHorizontalStretchable( true );
}
return fileBar;
@@ -1050,13 +1051,13 @@ QToolBar* QTReaderApp::viewbar()
switch (m_tbpol)
{
case cesMultiple:
viewBar = new QToolBar("View", this, m_tbposition);
break;
default:
- qDebug("Incorrect toolbar policy set");
+ odebug << "Incorrect toolbar policy set" << oendl;
case cesSingle:
case cesMenuTool:
viewBar = fileBar;
break;
}
}
@@ -1066,21 +1067,21 @@ QToolBar* QTReaderApp::navbar()
{
if (navBar == NULL)
{
switch (m_tbpol)
{
case cesMultiple:
-// qDebug("Creating new nav bar");
+// odebug << "Creating new nav bar" << oendl;
navBar = new QToolBar("Navigation", this, m_tbposition);
break;
default:
- qDebug("Incorrect toolbar policy set");
+ odebug << "Incorrect toolbar policy set" << oendl;
case cesSingle:
case cesMenuTool:
navBar = fileBar;
-// qDebug("Setting navbar to filebar");
+// odebug << "Setting navbar to filebar" << oendl;
break;
}
}
return navBar;
}
QToolBar* QTReaderApp::markbar()
@@ -1090,13 +1091,13 @@ QToolBar* QTReaderApp::markbar()
switch (m_tbpol)
{
case cesMultiple:
markBar = new QToolBar("Marks", this, m_tbposition);
break;
default:
- qDebug("Incorrect toolbar policy set");
+ odebug << "Incorrect toolbar policy set" << oendl;
case cesSingle:
case cesMenuTool:
markBar = fileBar;
break;
}
}
@@ -1124,13 +1125,13 @@ void QTReaderApp::suspend() { reader->suspend(); }
#ifdef USEMSGS
void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data)
{
QString msg = QString::fromUtf8(_msg);
-//// qDebug("Received:%s", (const char*)msg);
+//// odebug << "Received:" << msg << "" << oendl;
QDataStream stream( _data, IO_ReadOnly );
if ( msg == "info(QString)" )
{
QString info;
stream >> info;
@@ -1478,13 +1479,13 @@ void QTReaderApp::setfullscreen(bool sfs)
reader->bDoUpdates = true;
reader->update();
}
void QTReaderApp::buttonActionSelected(QAction* _a)
{
-//// qDebug("es:%x : %s (%u)", _a, (const char *)(_a->text()), ActNameToInt(_a->text()));
+//// odebug << "es:" << _a << " : " << (const char *)(_a->text()) << " (" << ActNameToInt(_a->text()) << ")" << oendl;
m_spaceTarget = ActNameToInt(_a->text());
}
QTReaderApp::~QTReaderApp()
{
}
@@ -1560,13 +1561,13 @@ void QTReaderApp::fileClose()
void QTReaderApp::updatefileinfo()
{
if (reader->m_string.isEmpty()) return;
if (reader->m_lastfile.isEmpty()) return;
tchar* nm = fromQString(reader->m_string);
tchar* fl = fromQString(reader->m_lastfile);
-// qDebug("Lastfile:%x", fl);
+// odebug << "Lastfile:" << fl << "" << oendl;
bool notadded = true;
if (pOpenlist == NULL) pOpenlist = new CList<Bkmk>;
else
{
for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++)
{
@@ -1574,32 +1575,32 @@ void QTReaderApp::updatefileinfo()
{
iter->value(reader->pagelocate());
unsigned short dlen;
unsigned char* data;
CFiledata fd(iter->anno());
reader->setSaveData(data, dlen, fd.content(), fd.length());
-// qDebug("Filedata(1):%u, %u", fd.length(), dlen);
+// odebug << "Filedata(1):" << fd.length() << ", " << dlen << "" << oendl;
// getstate(data, dlen);
iter->setAnno(data, dlen);
notadded = false;
delete [] data;
break;
}
}
}
-// qDebug("Added?:%x", notadded);
+// odebug << "Added?:" << notadded << "" << oendl;
if (notadded)
{
struct stat fnstat;
stat((const char *)reader->m_lastfile, &fnstat);
CFiledata fd(fnstat.st_mtime, fl);
unsigned short dlen;
unsigned char* data;
reader->setSaveData(data, dlen, fd.content(), fd.length());
pOpenlist->push_front(Bkmk(nm, data, dlen, reader->pagelocate()));
-// qDebug("Filedata(2):%u, %u", fd.length(), dlen);
+// odebug << "Filedata(2):" << fd.length() << ", " << dlen << "" << oendl;
delete [] data;
}
delete [] nm;
delete [] fl;
}
@@ -1608,13 +1609,13 @@ void QTReaderApp::fileOpen()
/*
menu->hide();
fileBar->hide();
if (regVisible) regBar->hide();
if (searchVisible) searchBar->hide();
*/
-// qDebug("fileOpen");
+// odebug << "fileOpen" << oendl;
// if (!reader->m_lastfile.isEmpty())
updatefileinfo();
fileOpen2();
}
void QTReaderApp::fileOpen2()
@@ -1649,13 +1650,13 @@ void QTReaderApp::fileOpen2()
{
openFile(fn);
}
reader->setFocus();
}
// reader->refresh();
-// qDebug("HEIGHT:%d", reader->m_lastheight);
+// odebug << "HEIGHT:" << reader->m_lastheight << "" << oendl;
}
QString QTReaderApp::usefilebrowser()
{
#ifndef USEQPE
QString s( QFileDialog::getOpenFileName( reader->m_lastfile, QString::null, this ) );
@@ -1669,13 +1670,13 @@ QString QTReaderApp::usefilebrowser()
QString fn;
if (fb->exec())
{
fn = fb->getCurrentFile();
}
-// qDebug("Selected %s", (const char*)fn);
+// odebug << "Selected " << fn << "" << oendl;
delete fb;
showEditTools();
return fn;
#endif
}
@@ -1800,13 +1801,13 @@ void QTReaderApp::showprefs()
reader->bstriphtml = true;
break;
case 4:
reader->bpeanut = true;
break;
default:
- qDebug("Format out of range");
+ odebug << "Format out of range" << oendl;
}
reader->bdepluck = prefwin->Depluck();
reader->bdejpluck = prefwin->Dejpluck();
reader->setContinuous(prefwin->Continuous());
m_spaceTarget = (ActionTypes)prefwin->spaceAction();
@@ -1860,13 +1861,13 @@ void QTReaderApp::showtoolbarprefs()
CBarPrefs* prefwin = new CBarPrefs(APPDIR, !m_bFloatingDialog, this);
#else
QFileInfo fi;
QDir d = QDir::home(); // "/"
if ( !d.cd(APPDIR) )
{ // "/tmp"
- qWarning( "Cannot find the \"~/%s\" directory", APPDIR );
+ owarn << "Cannot find the \"~/" << APPDIR << "\" directory" << oendl;
d = QDir::home();
d.mkdir(APPDIR);
d.cd(APPDIR);
}
fi.setFile(d, INIFILE);
CBarPrefs* prefwin = new CBarPrefs(fi.absFilePath(), !m_bFloatingDialog, this);
@@ -1897,13 +1898,13 @@ void QTReaderApp::showtoolbarprefs()
Config config( APPDIR );
#else
QFileInfo fi;
QDir d = QDir::home(); // "/"
if ( !d.cd(APPDIR) )
{ // "/tmp"
- qWarning( "Cannot find the \"~/%s\" directory", APPDIR );
+ owarn << "Cannot find the \"~/" << APPDIR << "\" directory" << oendl;
d = QDir::home();
d.mkdir(APPDIR);
d.cd(APPDIR);
}
fi.setFile(d, INIFILE);
Config config( fi.absFilePath() );
@@ -2172,13 +2173,13 @@ void QTReaderApp::editFind()
searchStack->push(new searchrecord("",reader->pagelocate()));
#endif
}
void QTReaderApp::findNext()
{
-// // qDebug("findNext called\n");
+// // odebug << "findNext called\n" << oendl;
#ifdef __ISEARCH
QString arg = searchEdit->text();
#else
QRegExp arg = searchEdit->text();
#endif
CDrawBuffer test(&(reader->m_fontControl));
@@ -2268,18 +2269,18 @@ bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg)
findClose();
pbar->hide();
reader->locate(pos);
return false;
}
}
-// qDebug("Found it at %u:%u", pos, offset);
+// odebug << "Found it at " << pos << ":" << offset << "" << oendl;
pbar->hide();
-// qDebug("Hid");
+// odebug << "Hid" << oendl;
reader->locate(pos+offset);
-// qDebug("Loacted");
-// qDebug("page up");
+// odebug << "Loacted" << oendl;
+// odebug << "page up" << oendl;
ret = true;
}
else
{
if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2)
pos = searchStart;
@@ -2330,13 +2331,13 @@ void QTReaderApp::search()
findNext();
}
#endif
void QTReaderApp::openFile( const QString &f )
{
-// qDebug("File:%s", (const char*)f);
+// odebug << "File:" << f << "" << oendl;
// openFile(DocLnk(f));
//}
//
//void QTReaderApp::openFile( const DocLnk &f )
//{
clear();
@@ -2377,25 +2378,25 @@ void QTReaderApp::resizeEvent(QResizeEvent* e)
showFullScreen();
}
}
*/
void QTReaderApp::handlekey(QKeyEvent* e)
{
-// qDebug("Keypress event");
+// odebug << "Keypress event" << oendl;
timeb now;
ftime(&now);
unsigned long etime = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm;
if (etime < m_debounce)
{
return;
}
m_lastkeytime = now;
switch(e->key())
{
case Key_Escape:
-// qDebug("escape event");
+// odebug << "escape event" << oendl;
if (m_disableesckey)
{
m_disableesckey = false;
}
else
{
@@ -2404,13 +2405,13 @@ void QTReaderApp::handlekey(QKeyEvent* e)
{
m_actFullscreen->setOn(false);
e->accept();
}
else
{
-// qDebug("escape action");
+// odebug << "escape action" << oendl;
doAction(m_escapeTarget, e);
}
}
break;
case Key_Space:
{
@@ -2503,17 +2504,17 @@ void QTReaderApp::showEditTools()
m_fontBar->hide();
// showNormal();
showFullScreen();
}
else
{
-// qDebug("him");
+// odebug << "him" << oendl;
#ifdef USEQPE
Global::hideInputMethod();
#endif
-// qDebug("eb");
+// odebug << "eb" << oendl;
menubar->show();
if (fileBar != NULL) fileBar->show();
if (viewBar != NULL) viewBar->show();
if (navBar != NULL) navBar->show();
if (markBar != NULL) markBar->show();
mb->show();
@@ -2529,26 +2530,26 @@ void QTReaderApp::showEditTools()
#ifdef USEQPE
Global::showInputMethod();
#endif
regBar->show();
}
if (m_fontVisible) m_fontBar->show();
-// qDebug("sn");
+// odebug << "sn" << oendl;
showNormal();
-// qDebug("sm");
+// odebug << "sm" << oendl;
#ifdef USEQPE
showMaximized();
#endif
// setCentralWidget(reader);
}
-// qDebug("uc");
+// odebug << "uc" << oendl;
updateCaption();
-// qDebug("rw");
+// odebug << "rw" << oendl;
editorStack->raiseWidget( reader );
-// qDebug("sf");
+// odebug << "sf" << oendl;
reader->setFocus();
reader->refresh();
}
/*
void QTReaderApp::save()
{
@@ -2611,13 +2612,13 @@ void QTReaderApp::setDocument(const QString& fileref)
openFile(fileref);
// showEditTools();
}
void QTReaderApp::closeEvent( QCloseEvent *e )
{
-// qDebug("Close event");
+// odebug << "Close event" << oendl;
if (m_fullscreen)
{
m_fullscreen = false;
showEditTools();
e->accept();
}
@@ -2628,13 +2629,13 @@ void QTReaderApp::closeEvent( QCloseEvent *e )
else
{
if (editorStack->visibleWidget() == reader)
{
if ((m_escapeTarget != cesNone) && m_bcloseDisabled)
{
-// qDebug("Close disabled");
+// odebug << "Close disabled" << oendl;
m_bcloseDisabled = false;
e->ignore();
}
else
{
if (m_fontVisible)
@@ -2706,13 +2707,13 @@ bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab)
int cnt = 0;
if (plist != NULL)
{
for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++)
{
#ifdef _UNICODE
-// qDebug("Item:%s", (const char*)toQString(i->name()));
+// odebug << "Item:" << toQString(i->name()) << "" << oendl;
bkmkselector->insertItem(toQString(i->name()));
#else
bkmkselector->insertItem(i->name());
#endif
cnt++;
}
@@ -2735,15 +2736,15 @@ void QTReaderApp::do_autogen()
}
void QTReaderApp::do_regedit()
{
// fileBar->hide();
reader->bDoUpdates = false;
-// qDebug("Showing regbar");
+// odebug << "Showing regbar" << oendl;
regBar->show();
-// qDebug("Showing kbd");
+// odebug << "Showing kbd" << oendl;
#ifdef USEQPE
Global::showInputMethod();
#endif
regVisible = true;
regEdit->setFocus();
// qApp->processEvents();
@@ -2753,16 +2754,16 @@ void QTReaderApp::do_regedit()
bool QTReaderApp::openfrombkmk(Bkmk* bk)
{
QString fn = toQString(
CFiledata(bk->anno()).name()
);
-// qDebug("fileinfo");
+// odebug << "fileinfo" << oendl;
if (!fn.isEmpty() && QFileInfo(fn).isFile())
{
-// qDebug("Opening");
+// odebug << "Opening" << oendl;
openFile(fn);
struct stat fnstat;
stat((const char *)reader->m_lastfile, &fnstat);
if (CFiledata(bk->anno()).date()
!= fnstat.st_mtime)
@@ -2778,13 +2779,13 @@ bool QTReaderApp::openfrombkmk(Bkmk* bk)
reader->putSaveData(svdata, svlen);
// setstate(svdata, svlen);
if (svlen != 0)
{
QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?");
}
-// qDebug("updating");
+// odebug << "updating" << oendl;
// showEditTools();
reader->locate(bk->value());
}
return true;
}
else
@@ -2809,13 +2810,13 @@ void QTReaderApp::gotobkmk(int ind)
}
break;
case cGotoBkmk:
reader->locate((*pBkmklist)[ind]->value());
break;
case cDelBkmk:
-//// qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name());
+//// odebug << "Deleting:" << (*pBkmklist)[ind]->name() << "\n" << oendl;
pBkmklist->erase(ind);
m_fBkmksChanged = true;
// pBkmklist->sort();
break;
case cRmBkmkFile:
{
@@ -2909,13 +2910,13 @@ void QTReaderApp::gotobkmk(int ind)
QMessageBox::information(this, PROGNAME, "Couldn't open input");
}
/*
CFileSelector *f = new CFileSelector("text/html", this, NULL, !m_bFloatingDialog, TRUE, TRUE );
int ret = f->exec();
- qDebug("Return:%d", ret);
+ odebug << "Return:" << ret << "" << oendl;
DocLnk* doc = f->getDoc();
if (doc != NULL)
{
FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r");
QString rt;
rt = "<html><body>\n";
@@ -2929,17 +2930,17 @@ void QTReaderApp::gotobkmk(int ind)
if ( doc->name().isEmpty() )
{
doc->setName(bkmkselector->text(ind));
}
FileManager fm;
fm.saveFile( *doc, rt );
- qDebug("YES");
+ odebug << "YES" << oendl;
}
else
{
- qDebug("NO");
+ odebug << "NO" << oendl;
}
delete f;
*/
#endif /* USEQPE */
}
@@ -3006,13 +3007,13 @@ void QTReaderApp::do_regaction()
#ifdef _SCROLLPIPE
case cSetPipeTarget:
do_setpipetarget(regEdit->text());
break;
#endif
case cSetConfigName:
-// qDebug("Saving config");
+// odebug << "Saving config" << oendl;
do_saveconfig(regEdit->text(), false);
break;
}
// reader->restore();
// fileBar->show();
reader->setFocus();
@@ -3098,45 +3099,45 @@ void QTReaderApp::setfontHelper(const QString& lcn, int size)
reader->ChangeFont(size);
}
}
void QTReaderApp::do_setencoding(int i)
{
-// qDebug("setencoding:%d", i);
+// odebug << "setencoding:" << i << "" << oendl;
if (m_fontAction == cChooseEncoding)
{
reader->setencoding(i);
}
reader->refresh();
m_fontBar->hide();
m_fontVisible = false;
-// qDebug("showedit");
+// odebug << "showedit" << oendl;
if (reader->isVisible()) showEditTools();
-// qDebug("showeditdone");
+// odebug << "showeditdone" << oendl;
}
void QTReaderApp::do_setfont(const QString& lcn)
{
if (m_fontAction == cChooseFont)
{
setfontHelper(lcn);
}
reader->refresh();
m_fontBar->hide();
m_fontVisible = false;
-// qDebug("showedit");
+// odebug << "showedit" << oendl;
//if (reader->isVisible())
showEditTools();
-// qDebug("showeditdone");
+// odebug << "showeditdone" << oendl;
}
void QTReaderApp::do_autogen(const QString& regText)
{
unsigned long fs, ts;
reader->sizes(fs,ts);
-// // qDebug("Reg:%s\n", (const tchar*)(regEdit->text()));
+// // odebug << "Reg:" << (const tchar*)(regEdit->text()) << "\n" << oendl;
m_autogenstr = regText;
QRegExp re(regText);
CBuffer buff;
if (pBkmklist != NULL) delete pBkmklist;
pBkmklist = new CList<Bkmk>;
m_fBkmksChanged = true;
@@ -3177,13 +3178,13 @@ void QTReaderApp::do_autogen(const QString& regText)
pbar->hide();
reader->refresh();
}
void QTReaderApp::saveprefs()
{
-// qDebug("saveprefs");
+// odebug << "saveprefs" << oendl;
// reader->saveprefs("uqtreader");
// if (!m_loadedconfig)
do_saveconfig( APPDIR, true );
/*
Config config( APPDIR );
@@ -3258,17 +3259,17 @@ void QTReaderApp::saveprefs()
savefilelist();
}
/*
void QTReaderApp::oldFile()
{
-// qDebug("oldFile called");
+// odebug << "oldFile called" << oendl;
reader->setText(true);
-// qDebug("settext called");
+// odebug << "settext called" << oendl;
showEditTools();
-// qDebug("showedit called");
+// odebug << "showedit called" << oendl;
}
*/
/*
void info_cb(Fl_Widget* o, void* _data)
{
@@ -3338,16 +3339,16 @@ void QTReaderApp::readfilelist()
d.cd(APPDIR);
QFileInfo fi(d, ".openfiles");
BkmkFile bf((const char *)fi.absFilePath());
#else /* USEQPE */
BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"));
#endif /* USEQPE */
-// qDebug("Reading open files");
+// odebug << "Reading open files" << oendl;
pOpenlist = bf.readall();
-// if (pOpenlist != NULL) qDebug("...with success");
-// else qDebug("...without success!");
+// if (pOpenlist != NULL) odebug << "...with success" << oendl;
+// else odebug << "...without success!" << oendl;
}
void QTReaderApp::savefilelist()
{
if (pOpenlist != NULL)
{
@@ -3356,13 +3357,13 @@ void QTReaderApp::savefilelist()
d.cd(APPDIR);
QFileInfo fi(d, ".openfiles");
BkmkFile bf((const char *)fi.absFilePath(), true);
#else /* USEQPE */
BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), true);
#endif /* USEQPE */
-// qDebug("Writing open files");
+// odebug << "Writing open files" << oendl;
bf.write(*pOpenlist);
}
}
void QTReaderApp::readbkmks()
{
@@ -3466,13 +3467,13 @@ void QTReaderApp::showAnnotation()
editorStack->raiseWidget( m_annoWin );
m_annoWin->setFocus();
}
void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, const QString& line)
{
-//// qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd);
+//// odebug << "OnWordSelected(" << posn << "):" << wrd << "" << oendl;
if (m_doClipboard)
{
QClipboard* cb = QApplication::clipboard();
cb->setText(wrd);
#ifdef USEQPE
@@ -3516,13 +3517,13 @@ void QTReaderApp::doAction(ActionTypes a, QKeyEvent* e)
{
e->ignore();
}
else
{
e->accept();
-// qDebug("Accepted");
+// odebug << "Accepted" << oendl;
switch (a)
{
case cesOpenFile:
{
fileOpen();
}
@@ -3579,13 +3580,13 @@ void QTReaderApp::doAction(ActionTypes a, QKeyEvent* e)
gotoStart();
break;
case cesEndDoc:
gotoEnd();
break;
default:
- qDebug("Unknown ActionType:%u", a);
+ odebug << "Unknown ActionType:" << a << "" << oendl;
break;
}
}
}
void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); }
@@ -3597,13 +3598,13 @@ void QTReaderApp::SaveConfig()
regEdit->setText(reader->m_string);
do_regedit();
}
void QTReaderApp::do_saveconfig(const QString& _txt, bool full)
{
-// qDebug("do_saveconfig:%s", (const char*)_txt);
+// odebug << "do_saveconfig:" << _txt << "" << oendl;
#ifdef USEQPE
QString configname;
Config::Domain dom;
if (full)
{
@@ -3620,44 +3621,44 @@ void QTReaderApp::do_saveconfig(const QString& _txt, bool full)
config.setGroup( "View" );
#else
QFileInfo fi;
if (full)
{
-// qDebug("full:%s", (const char*)_txt);
+// odebug << "full:" << _txt << "" << oendl;
QDir d = QDir::home(); // "/"
if ( !d.cd(_txt) )
{ // "/tmp"
- qWarning( "Cannot find the \"~/%s\" directory", (const char*)_txt );
+ owarn << "Cannot find the \"~/" << _txt << "\" directory" << oendl;
d = QDir::home();
d.mkdir(_txt);
d.cd(_txt);
}
fi.setFile(d, INIFILE);
}
else
{
QDir d = QDir::home(); // "/"
if ( !d.cd(APPDIR) )
{ // "/tmp"
- qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
+ owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl;
d = QDir::home();
d.mkdir(APPDIR);
d.cd(APPDIR);
}
if ( !d.cd("configs") )
{ // "/tmp"
- qWarning( "Cannot find the \"~/" APPDIR "/configs\" directory" );
+ owarn << "Cannot find the \"~/" APPDIR "/configs\" directory" << oendl;
d = QDir::home();
d.cd(APPDIR);
d.mkdir("configs");
d.cd("configs");
}
fi.setFile(d, _txt);
}
-// qDebug("Path:%s", (const char*)fi.absFilePath());
+// odebug << "Path:" << fi.absFilePath() << "" << oendl;
Config config(fi.absFilePath());
#endif
config.writeEntry( "StripCr", reader->bstripcr );
config.writeEntry( "AutoFmt", reader->bautofmt );
@@ -3931,32 +3932,32 @@ bool QTReaderApp::readconfig(const QString& _txt, bool full=false)
QFileInfo fi;
if (full)
{
QDir d = QDir::home(); // "/"
if ( !d.cd(_txt) )
{ // "/tmp"
- qWarning( "Cannot find the \"~/%s\" directory", (const char*)_txt );
+ owarn << "Cannot find the \"~/" << _txt << "\" directory" << oendl;
d = QDir::home();
d.mkdir(_txt);
d.cd(_txt);
}
fi.setFile(d, INIFILE);
}
else
{
QDir d = QDir::home(); // "/"
if ( !d.cd(APPDIR) )
{ // "/tmp"
- qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
+ owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl;
d = QDir::home();
d.mkdir(APPDIR);
d.cd(APPDIR);
}
if ( !d.cd("configs") )
{ // "/tmp"
- qWarning( "Cannot find the \"~/" APPDIR "/configs\" directory" );
+ owarn << "Cannot find the \"~/" APPDIR "/configs\" directory" << oendl;
d = QDir::home();
d.mkdir("configs");
d.cd("configs");
}
fi.setFile(d, _txt);
}
@@ -4058,19 +4059,19 @@ bool QTReaderApp::PopulateConfig(const char* tgtdir)
bkmkselector->setText("Cancel");
#ifndef USEQPE
int cnt = 0;
QDir d = QDir::home(); // "/"
if ( !d.cd(APPDIR) ) { // "/tmp"
- qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
+ owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl;
d = QDir::home();
d.mkdir(APPDIR);
d.cd(APPDIR);
}
if ( !d.cd(tgtdir) ) { // "/tmp"
- qWarning( "Cannot find the \"~/" APPDIR "/%s\" directory", tgtdir );
+ owarn << "Cannot find the \"~/" APPDIR "/" << tgtdir << "\" directory" << oendl;
d = QDir::home();
d.mkdir(tgtdir);
d.cd(tgtdir);
}
d.setFilter( QDir::Files | QDir::NoSymLinks );
// d.setSorting( QDir::Size | QDir::Reversed );
@@ -4081,13 +4082,13 @@ bool QTReaderApp::PopulateConfig(const char* tgtdir)
while ( (fi=it.current()) ) { // for each file...
bkmkselector->insertItem(fi->fileName());
cnt++;
- //qDebug( "%10li %s", fi->size(), fi->fileName().data() );
+ //odebug << "" << fi->size() << " " << fi->fileName().data() << "" << oendl;
++it; // goto next list element
}
#else /* USEQPE */
int cnt = 0;
DIR *d;
@@ -4165,13 +4166,13 @@ void QTReaderApp::OnURLSelected(const QString& href)
m_url_localfile = urld->localfile();
m_url_globalfile = urld->globalfile();
if (m_url_clipboard)
{
QClipboard* cb = QApplication::clipboard();
cb->setText(href);
- qDebug("<a href=\"%s\">%s</a>", (const char*)href, (const char*)href);
+ odebug << "<a href=\"" << href << "\">" << href << "</a>" << oendl;
}
if (m_url_localfile)
{
writeUrl(reader->m_string, href);
}
if (m_url_globalfile)
@@ -4189,20 +4190,20 @@ void QTReaderApp::writeUrl(const QString& file, const QString& href)
filename = Global::applicationFileName(APPDIR "/urls", file);
#else
QFileInfo fi;
QDir d = QDir::home(); // "/"
if ( !d.cd(APPDIR) )
{ // "/tmp"
- qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
+ owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl;
d = QDir::home();
d.mkdir(APPDIR);
d.cd(APPDIR);
}
if ( !d.cd("urls") )
{ // "/tmp"
- qWarning( "Cannot find the \"~/" APPDIR "/urls\" directory" );
+ owarn << "Cannot find the \"~/" APPDIR "/urls\" directory" << oendl;
d = QDir::home();
d.cd(APPDIR);
d.mkdir("urls");
d.cd("urls");
}
fi.setFile(d, file);