-rw-r--r-- | noncore/apps/opie-reader/QTReaderApp.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-reader/opie-reader.control | 2 | ||||
-rw-r--r-- | noncore/apps/opie-reader/opie-reader.pro | 1 |
3 files changed, 6 insertions, 5 deletions
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp index 8ef0674..b985094 100644 --- a/noncore/apps/opie-reader/QTReaderApp.cpp +++ b/noncore/apps/opie-reader/QTReaderApp.cpp @@ -1,498 +1,498 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. Allrights reserved. ** ** This file is part of Qt Palmtop Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** 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 #include <qcombobox.h> #include <qpopupmenu.h> #include <qaction.h> #include <qapplication.h> #include <qlineedit.h> #include <qtoolbutton.h> #include <qspinbox.h> #include <qobjectlist.h> #include <qstatusbar.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 "util.h" #include <qfontdatabase.h> #ifdef USEQPE -#include <qpe/resource.h> +#include <opie2/oresource.h> #ifdef OPIE #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&, 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")); return hd + "/pics"; } #define PICDIR picdir() #endif #endif unsigned long QTReaderApp::m_uid = 0; void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); } #ifdef USEQPE -#define geticon(iconname) Resource::loadPixmap( iconname ) -#define getmyicon(iconname) Resource::loadPixmap( PICDIR iconname ) +#define geticon(iconname) Opie::Core::OResource::loadPixmap( iconname, Opie::Core::OResource::SmallIcon ) +#define getmyicon(iconname) Opie::Core::OResource::loadPixmap( PICDIR iconname, Opie::Core::OResource::SmallIcon ) #else //#define geticon(iconname) QPixmap(PICDIR iconname ".png") #define geticon(iconname) QPixmap(PICDIR +"/"+iconname+".png") #define getmyicon(iconname) geticon(iconname) //#define geticon(iconname) QIconSet( QPixmap(PICDIR iconname) ) #endif #ifndef _WINDOWS #include <unistd.h> #endif #include <stddef.h> #ifndef _WINDOWS #include <dirent.h> #endif void QTReaderApp::listBkmkFiles() { bkmkselector->clear(); bkmkselector->setText("Cancel"); #ifndef USEQPE int cnt = 0; QDir d = QDir::home(); // "/" if ( !d.cd(APPDIR) ) { // "/tmp" qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); d = QDir::home(); d.mkdir(APPDIR); 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++); //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++); } } 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(); #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) { #ifdef USEQPE Global::hideInputMethod(); #endif regBar->hide(); } if (searchVisible) { #ifdef USEQPE Global::hideInputMethod(); #endif searchBar->hide(); } } QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) : QMainWindow( parent, name, f ), m_dontSave(false), fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL), m_scrollbar(NULL), m_localscroll(2), m_hidebars(false), m_kmapchanged(false) { { setKeyCompression ( true ); #ifndef USEQPE QDir d = QDir::home(); // "/" d.cd(APPDIR); QFileInfo fi(d, ".keymap"); FILE* f = fopen((const char *)fi.absFilePath(), "r"); #else /* USEQPE */ FILE* f = fopen((const char *)Global::applicationFileName(APPDIR,".keymap"), "r"); #endif /* USEQPE */ if (f != NULL) { uint cnt; if ((fread(&cnt, sizeof(cnt), 1, f) != 0) && (cnt == KEYMAPVERSION)) { if (fread(&cnt, sizeof(cnt), 1, f) == 0) cnt = 0; for (uint i = 0; i != cnt; i++) { orKey key; int data; fread(&key, sizeof(key), 1, f); fread(&data, sizeof(data), 1, f); kmap[key] = data; } } fclose(f); } } 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")); m_bcloseDisabled = true; m_disableesckey = false; pBkmklist = NULL; pOpenlist = NULL; // doc = 0; m_fBkmksChanged = false; QString lang = getenv( "LANG" ); QString rot = getenv( "QWS_DISPLAY" ); /* int m_rot = 0; if (rot.contains("Rot90")) { m_rot = 90; } else if (rot.contains("Rot180")) { m_rot = 180; } else if (rot.contains("Rot270")) { m_rot = 270; } // qDebug("Initial Rotation(%d):%s", m_rot, (const char*)rot); */ m_autogenstr = "^ *[A-Z].*[a-z] *$"; #ifdef USEQPE - setIcon( Resource::loadPixmap( PICDIR "uqtreader") ); + setIcon( Opie::Core::OResource::loadPixmap( PICDIR "uqtreader", Opie::Core::OResource::SmallIcon ) ); #else setIcon( QPixmap (PICDIR + "/uqtreader.png") ); #endif /* USEQPE */ // QPEToolBar *bar = new QPEToolBar( this ); // menubar = new QPEToolBar( this ); #ifdef USEQPE Config config( APPDIR ); #else QDir d = QDir::home(); // "/" if ( !d.cd(APPDIR) ) { // "/tmp" qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); d = QDir::home(); d.mkdir(APPDIR); d.cd(APPDIR); } QFileInfo fi(d, INIFILE); // qDebug("Path:%s", (const char*)fi.absFilePath()); 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); 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); #if defined(USEQPE) menubar = new QToolBar("Menus", this, m_tbposition); mb = new QPEMenuBar( menubar ); #else mb = new QMenuBar( this ); #endif #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 ); QPopupMenu *view = new QPopupMenu( mb ); tmp->insertItem( tr( "View" ), view ); QPopupMenu *marks = new QPopupMenu( this ); tmp->insertItem( tr( "Marks" ), marks ); QPopupMenu *settings = new QPopupMenu( this ); tmp->insertItem( tr( "Settings" ), settings ); // addToolBar(menubar, "Menus",QMainWindow::Top); // addToolBar(fileBar, "Toolbar",QMainWindow::Top); // QPopupMenu *edit = new QPopupMenu( this ); /* QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); a->addTo( bar ); a->addTo( file ); */ QWidget* widge = new QWidget(this); setCentralWidget( widge ); QVBoxLayout* vlayout = new QVBoxLayout(widge); m_layout = new QBoxLayout(QBoxLayout::LeftToRight); m_prog = new QLabel(widge); vlayout->addLayout(m_layout, 1); vlayout->addWidget(m_prog); editorStack = new QWidgetStack( widge ); // setCentralWidget( editorStack ); searchVisible = FALSE; regVisible = FALSE; m_fontVisible = false; m_buttonprefs = new CButtonPrefs(&kmap, this); editorStack->addWidget(m_buttonprefs, get_unique_id()); connect( m_buttonprefs, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); m_annoWin = new CAnnoEdit(editorStack); editorStack->addWidget(m_annoWin, get_unique_id()); connect( m_annoWin, SIGNAL( finished(const QString&, const QString&) ), this, SLOT( addAnno(const QString&, const QString&) ) ); connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) ); m_infoWin = new infowin(editorStack); editorStack->addWidget(m_infoWin, get_unique_id()); connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) ); m_graphicwin = new GraphicWin(editorStack); editorStack->addWidget(m_graphicwin, get_unique_id()); connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); // bkmkselector = new QListBox(editorStack, "Bookmarks"); bkmkselector = new CBkmkSelector(editorStack, "Bookmarks"); // connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) ); connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) ); connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) ); editorStack->addWidget( bkmkselector, get_unique_id() ); /* importSelector = new FileSelector( "*", editorStack, "importselector", false ); connect( importSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( importFile( const DocLnk & ) ) ); editorStack->addWidget( importSelector, get_unique_id() ); // don't need the close visible, it is redundant... importSelector->setCloseVisible( FALSE ); */ // qDebug("Reading file list"); readfilelist(); 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 ); reader->setForeground(getcolour(m_foreground)); m_scrollcolor = config.readNumEntry( "ScrollColour", 5 ); setscrollcolour(); m_scrollbarcolor = config.readNumEntry( "ScrollBarColour", 5 ); diff --git a/noncore/apps/opie-reader/opie-reader.control b/noncore/apps/opie-reader/opie-reader.control index 60976b2..d53f70d 100644 --- a/noncore/apps/opie-reader/opie-reader.control +++ b/noncore/apps/opie-reader/opie-reader.control @@ -1,10 +1,10 @@ Package: opie-reader Files: bin/reader lib/libreader* plugins/reader/* apps/Applications/opie-reader.desktop pics/opie-reader/* Priority: optional Section: opie/applications Maintainer: Tim Wentford <timwentford@hotmail.com> Architecture: arm -Depends: task-opie-minimal +Depends: task-opie-minimal, libopiecore2 License: GPL Description: E-Book reader Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/apps/opie-reader/opie-reader.pro b/noncore/apps/opie-reader/opie-reader.pro index 47980e1..da39154 100644 --- a/noncore/apps/opie-reader/opie-reader.pro +++ b/noncore/apps/opie-reader/opie-reader.pro @@ -1,24 +1,25 @@ TEMPLATE = subdirs SUBDIRS = pluckerbaselib \ codeclib \ pdblib \ PluckerCodec \ AportisCodec \ CHM \ HTMLFilter \ WeaselCodec \ iSiloCodec \ ppmsCodec \ FliteCmd \ pluckerdecompress \ ArriereCodec \ RebCodec \ reader +LIBS += -lopiecore2 # these are added only built if enabled in "make menuconfig" # FliteDyn # FliteDyn16 include( $(OPIEDIR)/include.pro ) |