-rw-r--r-- | noncore/apps/opie-gutenbrowser/browserDialog.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/config.in | 6 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/openetext.cpp | 35 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/opie-gutenbrowser.pro | 9 |
4 files changed, 32 insertions, 27 deletions
diff --git a/noncore/apps/opie-gutenbrowser/browserDialog.cpp b/noncore/apps/opie-gutenbrowser/browserDialog.cpp index 5c48da1..81dd516 100644 --- a/noncore/apps/opie-gutenbrowser/browserDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/browserDialog.cpp @@ -1,29 +1,32 @@ /**************************************************************************** copyright 2001 by L.J. Potter ljp@llornkcor.com copyright : (C) 2000 -2004 by llornkcor email : ljp@llornkcor.com ****************************************************************************/ #include "optionsDialog.h" //#include "fileBrowser.h" +/* OPIE */ +#include <opie2/ofiledialog.h> +using namespace Opie::Ui; + +/* QT */ #include <qlabel.h> #include <qlistbox.h> #include <qpushbutton.h> #include <qlayout.h> -#include <opie/ofiledialog.h> - void optionsDialog::BrowserDlg( ) { // setCaption( tr( "Choose Browser" ) ); http_ListBox1->insertItem( tr( "Opera")); http_ListBox1->insertItem( tr( "Konqueror")); http_ListBox1->insertItem( tr( "wget")); } void optionsDialog::select_title(int) { browserName = http_ListBox1->currentText(); Config config("Gutenbrowser"); config.setGroup( "Browser" ); @@ -62,22 +65,22 @@ void optionsDialog::BrowseSelected() { // } else { // QString sMsg; // sMsg = "Error opening library filelist "+fileName; // } if ( !fileName.isNull() ) { // got a file name // ... } } } void optionsDialog::setHttp(int index) { - Config config("Gutenbrowser"); + Config config("Gutenbrowser"); config.setGroup( "HttpServer" ); qDebug("writing http server"); if( index== 0) { config.writeEntry("Preferred", "http://sailor.gutenberg.org"); } else { config.writeEntry("Preferred", "http://www.prairienet.org/pg"); } } diff --git a/noncore/apps/opie-gutenbrowser/config.in b/noncore/apps/opie-gutenbrowser/config.in index ec67d6e..d2a3033 100644 --- a/noncore/apps/opie-gutenbrowser/config.in +++ b/noncore/apps/opie-gutenbrowser/config.in @@ -1,4 +1,6 @@ - config OPIE-GUTENBROWSER + config GUTENBROWSER boolean "gutenbrowser - Gutenberg Project etext reader and selector" default "n" - depends ( LIBQPE || LIBQPE-X11 ) && FTPLIB + depends ( LIBQPE || LIBQPE-X11 ) && FTPLIB && LIBOPIE2CORE && LIBOPIE2UI + comment "gutenbrowser needs a libqpe, ftplib, libopie2core and libopie2ui" + depends !(( LIBQPE || LIBQPE-X11 ) && FTPLIB && LIBOPIE2CORE && LIBOPIE2UI) diff --git a/noncore/apps/opie-gutenbrowser/openetext.cpp b/noncore/apps/opie-gutenbrowser/openetext.cpp index 40f35d6..bd44ce6 100644 --- a/noncore/apps/opie-gutenbrowser/openetext.cpp +++ b/noncore/apps/opie-gutenbrowser/openetext.cpp @@ -7,33 +7,34 @@ ***************************************************************************/ /*************************************************************************** * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ #include "gutenbrowser.h" #include "openetext.h" #include "editTitle.h" -#include <qfileinfo.h> +/* OPIE */ +#include <opie2/ofiledialog.h> #include <qpe/applnk.h> +#include <qpe/config.h> #include <qpe/qpeapplication.h> +using namespace Opie::Ui; #include <stdlib.h> #include <qtextstream.h> -#include <qpe/config.h> - -#include <opie/ofiledialog.h> +#include <qfileinfo.h> #if defined(_WS_WIN_) #include <windows.h> #else #include <unistd.h> #include "sys/stat.h" #endif OpenEtext::OpenEtext(QWidget *parent, QString name) : QDialog(parent,name,true) { local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; local_index=local_library+"GUTINDEX.ALL"; @@ -140,57 +141,57 @@ OpenFileButton->setDown(TRUE); // for ( f = fileList.begin(); f != fileList.end(); f++ ) { // fileTemp = *f; // fileTemp.right( fileTemp.length()-5); // fileName = fileTemp; // if( !fileName.isEmpty() ){ // filer = fileName; // } else { //filename is empty // // QString sMsg; // // sMsg = "Error opening library filelist "+fileName; // } if( filer.right(4) == ".txt" - || filer.right(4) == ".TXT" - || filer.right(4) == ".etx" - || filer.right(4) == ".ETX" - || filer.right(4) == ".etx" - || filer.right(4) == ".ETX" - || filer.right(4) == ".zip" - || filer.right(4) == ".ZIP" ) { + || filer.right(4) == ".TXT" + || filer.right(4) == ".etx" + || filer.right(4) == ".ETX" + || filer.right(4) == ".etx" + || filer.right(4) == ".ETX" + || filer.right(4) == ".zip" + || filer.right(4) == ".ZIP" ) { QFileInfo zipFile( filer); QString s_fileName = zipFile.fileName(); QString cmd; if( s_fileName.right(4) == ".zip") { // unzip that sucker.... s_fileName = s_fileName.left( s_fileName.length() - 4); if( chdir((const char*)local_library.latin1())!=0) qDebug("chdir failed.");// QString cmd = "gunzip -d " + filer + " -d " + local_library; cmd = "gunzip -S .zip " + filer; fileName = local_library + s_fileName + ".txt"; system( cmd); } // this renames the .txt to .etx!! else /*if( s_fileName.right(4) == ".txt" || if( s_fileName.right(4) == ".TXT"))*/ { // qDebug("Filename is "+fileName); s_fileName = fileName; s_fileName.replace( s_fileName.length()-3,3,"gtn");// s_fileName.replace( s_fileName.length()-3,3,"etx"); rename(fileName.latin1(),s_fileName.latin1()); fileName = s_fileName; // qDebug("Filename is now "+fileName); } } else - fileName = str; - + fileName = str; + FindTitle(fileName); - + QFileInfo fi( fileName); name_file = fi.fileName(); name_file = name_file.left(name_file.length() - 4); qDebug("Setting doclink"); DocLnk lnk; qDebug("name is " + name_file); lnk.setName(name_file); //sets file name qDebug("Title is "+title); lnk.setComment(title); QListBox_1->clear(); @@ -215,25 +216,25 @@ bool OpenEtext::FindTitle( QString filename) config.setGroup( "Files" ); QString s_numofFiles = config.readEntry("NumberOfFiles", "0"); int i_numofFiles = s_numofFiles.toInt(); QFileInfo fi(filename); name = fi.fileName(); qDebug("filename to open is " + name); QFile indexLib( filename); bool findCheck = FALSE; // int Titlenumber=0; if ( indexLib.open( IO_ReadOnly) ) { - qDebug("file opened successfully"); + qDebug("file opened successfully"); QTextStream indexStream( &indexLib ); QString target = "Project Gutenberg Etext of"; QString target2 = "Project Gutenberg Etext"; QString target3 = "Project Gutenberg's Etext of"; QString target4 = "Project Gutenberg's Etext"; QString indexLine; while ( !indexStream.eof() ) { // until end of file.. indexLine = indexStream.readLine(); if( indexLine.find(target, 0, TRUE) > -1 && !findCheck) {findCheck = TRUE; title = indexLine.mid( indexLine.find(target, 0, TRUE) + (target.length()) , indexLine.find("\r", 0, TRUE)); title = title.left( title.find( "*",0, TRUE)); @@ -255,26 +256,26 @@ bool OpenEtext::FindTitle( QString filename) title = title.left( title.find( "*",0, TRUE)); title = title.stripWhiteSpace (); // qDebug("Found the title 3 and it is %s", title.latin1()); } if( indexLine.find( target4, 0, TRUE) > -1 && !findCheck) { findCheck = TRUE; title = indexLine.mid( indexLine.find( target4, 0, TRUE) + ( target4.length()) , indexLine.find("\r", 0, TRUE)); title = title.left( title.find( "*",0, TRUE)); title = title.stripWhiteSpace (); // qDebug("Found the title 4 and it is %s", title.latin1()); } } //endof file - indexLib.close(); - + indexLib.close(); + if( !findCheck || title.length() < 2) { qDebug("Trying hard to find title from GUTINDEX.ALL"); title = titleFromLibrary( filename); findCheck = TRUE; } if ( checkConf() == false && findCheck == TRUE) { config.setGroup( "Files"); config.writeEntry("NumberOfFiles",i_numofFiles + 1 ); QString interger; interger.setNum( i_numofFiles +1); diff --git a/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.pro b/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.pro index e34e922..5c1d0c4 100644 --- a/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.pro +++ b/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.pro @@ -1,45 +1,44 @@ TEMPLATE = app -CONFIG += qt warn_on release quick-app -#CONFIG += qt warn_on release qpp +CONFIG += qt warn_on quick-app HEADERS = LibraryDialog.h \ SearchDialog.h \ SearchResults.h \ helpme.h \ multiline_ex.h \ openetext.h \ editTitle.h \ fontDialog.h \ optionsDialog.h \ helpwindow.h \ - output.h \ + output.h \ NetworkDialog.h \ gutenbrowser.h \ resource.h SOURCES = LibraryDialog.cpp \ LibraryDialogData.cpp \ SearchDialog.cpp \ SearchResults.cpp \ browserDialog.cpp \ helpme.cpp \ multiline_ex.cpp \ fontDialog.cpp \ openetext.cpp \ openetextdata.cpp \ editTitle.cpp \ ftpsitedlg.cpp \ optionsDialog.cpp \ optionsDialogData.cpp \ helpwindow.cpp \ output.cpp \ NetworkDialog.cpp \ - gutenbrowserData.cpp \ + gutenbrowserData.cpp \ gutenbrowser.cpp \ main.cpp TARGET = gutenbrowser INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include DESTDIR = $(OPIEDIR)/bin -LIBS += -lqpe -lpthread -lftplib -lopie +LIBS += -lqpe -lpthread -lftplib -lopiecore2 -lopieui2 include ( $(OPIEDIR)/include.pro ) |