summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialog.cpp1067
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialog.h126
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialog.obin0 -> 83212 bytes
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp281
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialogData.obin0 -> 15972 bytes
-rw-r--r--noncore/apps/opie-gutenbrowser/NetworkDialog.cpp329
-rw-r--r--noncore/apps/opie-gutenbrowser/NetworkDialog.h84
-rw-r--r--noncore/apps/opie-gutenbrowser/SearchDialog.cpp135
-rw-r--r--noncore/apps/opie-gutenbrowser/SearchDialog.h57
-rw-r--r--noncore/apps/opie-gutenbrowser/SearchResults.cpp101
-rw-r--r--noncore/apps/opie-gutenbrowser/SearchResults.h51
-rw-r--r--noncore/apps/opie-gutenbrowser/bookmarksdlg.cpp34
-rw-r--r--noncore/apps/opie-gutenbrowser/bookmarksdlg.h55
-rw-r--r--noncore/apps/opie-gutenbrowser/browserDialog.cpp83
-rw-r--r--noncore/apps/opie-gutenbrowser/config.in4
-rw-r--r--noncore/apps/opie-gutenbrowser/editTitle.cpp54
-rw-r--r--noncore/apps/opie-gutenbrowser/editTitle.h34
-rw-r--r--noncore/apps/opie-gutenbrowser/editTitle.ui100
-rw-r--r--noncore/apps/opie-gutenbrowser/fontDialog.cpp260
-rw-r--r--noncore/apps/opie-gutenbrowser/fontDialog.h59
-rw-r--r--noncore/apps/opie-gutenbrowser/fontDialog.ui201
-rw-r--r--noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp247
-rw-r--r--noncore/apps/opie-gutenbrowser/gutenbrowser.cpp1984
-rw-r--r--noncore/apps/opie-gutenbrowser/gutenbrowser.h226
-rw-r--r--noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp328
-rw-r--r--noncore/apps/opie-gutenbrowser/helpme.cpp122
-rw-r--r--noncore/apps/opie-gutenbrowser/helpme.h60
-rw-r--r--noncore/apps/opie-gutenbrowser/helpwindow.cpp326
-rw-r--r--noncore/apps/opie-gutenbrowser/helpwindow.h67
-rw-r--r--noncore/apps/opie-gutenbrowser/main.cpp64
-rw-r--r--noncore/apps/opie-gutenbrowser/multiline_ex.cpp133
-rw-r--r--noncore/apps/opie-gutenbrowser/multiline_ex.h108
-rw-r--r--noncore/apps/opie-gutenbrowser/openetext.cpp517
-rw-r--r--noncore/apps/opie-gutenbrowser/openetext.h82
-rw-r--r--noncore/apps/opie-gutenbrowser/openetextdata.cpp77
-rw-r--r--noncore/apps/opie-gutenbrowser/opie-gutenbrowser.control11
-rw-r--r--noncore/apps/opie-gutenbrowser/opie-gutenbrowser.pro45
-rw-r--r--noncore/apps/opie-gutenbrowser/optionsDialog.cpp207
-rw-r--r--noncore/apps/opie-gutenbrowser/optionsDialog.h112
-rw-r--r--noncore/apps/opie-gutenbrowser/optionsDialogData.cpp171
-rw-r--r--noncore/apps/opie-gutenbrowser/output.cpp36
-rw-r--r--noncore/apps/opie-gutenbrowser/output.h30
-rw-r--r--noncore/apps/opie-gutenbrowser/resource.h73
-rw-r--r--noncore/apps/opie-gutenbrowser/unzip.readme4
44 files changed, 8145 insertions, 0 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
new file mode 100644
index 0000000..157a3da
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
@@ -0,0 +1,1067 @@
+/***************************************************************************
+// LibraryDialog.cpp - description
+// -------------------
+// begin : Sat Aug 19 2000
+// copyright : (C) 2000 - 2004 by llornkcor
+// email : ljp@llornkcor.com
+// ***************************************************/
+// /***************************************************************************
+// * 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. *
+// ***************************************************************************/
+//ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL
+
+#include <qpe/applnk.h>
+#include <qpe/qpeapplication.h>
+#include <qpe/qpedialog.h>
+
+#include "LibraryDialog.h"
+#include "output.h"
+
+#include <qpushbutton.h>
+#include <qmultilineedit.h>
+//#include <qlayout.h>
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/*
+ * The dialog will by default be modeless, unless you set 'modal' to
+ * TRUE to construct a modal dialog. */
+LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, WFlags fl )
+ : QDialog( parent, name, true/* modal*/, fl )
+{
+ if ( !name )
+ setName( "LibraryDialog" );
+ indexLoaded=false;
+ initDialog();
+
+ // this->setMaximumWidth(240);
+
+ index = "GUTINDEX.ALL";
+ local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
+ local_index = local_library + index;
+
+ QString iniFile ;
+ iniFile = QPEApplication::qpeDir()+"/etc/gutenbrowser/gutenbrowserrc";
+
+ new_index =QPEApplication::qpeDir()+"/etc/gutenbrowser/PGWHOLE.TXT";
+
+ old_index = QPEApplication::qpeDir()+"/etc/gutenbrowser/GUTINDEX.ALL";
+ // old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL";
+
+ // iniFile = local_library+"gutenbrowserrc";
+ // new_index = local_library + "PGWHOLE.TXT";
+ // old_index = local_library + "GUTINDEX.ALL";
+
+ Config config("Gutenbrowser");
+
+ config.setGroup( "HttpServer" );
+ proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org");
+
+ config.setGroup( "FTPsite" );
+ ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org");
+ qDebug("Library Dialog: ftp_host is "+ftp_host);
+ // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) );
+ // ftp_host=ftp_host.stripWhiteSpace();
+ ftp_base_dir= config.readEntry("base", "/pub/gutenberg");
+
+ i_binary = 0;
+
+ config.setGroup("SortAuth");
+ if( config.readEntry("authSort", "FALSE") == "TRUE")
+ authBox->setChecked(TRUE);
+
+ config.setGroup("General");
+ downDir =config.readEntry( "DownloadDirectory",local_library);
+ qDebug("downDir is "+downDir);
+ newindexLib.setName( old_index);
+ indexLib.setName( old_index);
+
+ new QPEDialogListener(this);
+}
+
+LibraryDialog::~LibraryDialog()
+{
+ delete QList_Item2;
+ delete QList_Item1;
+ delete QList_Item3;
+ delete QList_Item4;
+ delete QList_Item5;
+
+ saveConfig();
+}
+
+ /*This groks using PGWHOLE.TXT */
+void LibraryDialog::Newlibrary()
+{
+#ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files
+ //qDebug("Opening new library index %s",newindexLib);
+ if ( newindexLib.open( IO_ReadOnly) ) {
+ setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully
+ QTextStream indexStream( &newindexLib );
+ QString indexLine;
+ while ( !indexStream.atEnd() ) { // until end of file..
+ indexLine = indexStream.readLine();
+ if ( ( indexLine.mid(4,4)).toInt() && !( indexLine.left(3)).toInt()) {
+ year = indexLine.mid(4,4);
+ year = year.stripWhiteSpace();
+ file = indexLine.mid( indexLine.find( "[", 0, TRUE )+1, 12 );
+ file = file.stripWhiteSpace();
+ number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 );
+ if( year.toInt() < 1984)
+ number = number.left( number.length() -1 );
+ number = number.stripWhiteSpace();
+ title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() );
+ title = title.stripWhiteSpace();
+
+ getAuthor(); // groks author
+ author = author.stripWhiteSpace();
+ if (authBox->isChecked()) { // this reverses the first name and last name of the author
+ // qDebug("Sorting last name first");
+ QString lastName, firstName="";
+ int finder=author.findRev( ' ', -1, TRUE);
+ lastName=author.right( author.length()-finder);
+ firstName=author.left(finder);
+ lastName=lastName.stripWhiteSpace();
+ firstName=firstName.stripWhiteSpace();
+
+ if( lastName.find( firstName, 0, true) == -1) // this avoids dup names
+ author=lastName+", "+firstName;
+ }
+
+ if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) && (file.find( "]",0, TRUE) == -1) ) {
+
+ // fill string list or something to be able to resort the whole library
+ if( author.isEmpty() )
+ QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file );
+ else {
+
+ if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) ||
+ (author.left(1) >= QString("a") && author.left(1) <= QString("f")) )
+ QList_Item1 = new QListViewItem( ListView1,/* number,*/ title, author, year, file );
+
+ else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) ||
+ (author.left(1) >= QString("g") && author.left(1) <= QString("m")) )
+ QList_Item2 = new QListViewItem( ListView2, /*number, */title, author, year, file );
+
+ else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) ||
+ (author.left(1) >= QString("n") && author.left(1) <= QString("r")) )
+ QList_Item3 = new QListViewItem( ListView3, /*number,*/ title, author, year, file );
+
+ else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) ||
+ (author.left(1) >= QString("s") && author.left(1) <= QString("z")) )
+ QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file );
+
+ else
+ QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file );
+ }
+ }
+ }// end if
+ }// end while
+ newindexLib.close();
+ }
+#ifndef Q_WS_QWS
+ setCursor( arrowCursor);
+#endif
+#endif
+} // end Newlibrary()
+
+
+void LibraryDialog::Library()
+{// old library groking method
+
+ ListView1->clear();
+ ListView2->clear();
+ ListView3->clear();
+ ListView4->clear();
+ ListView5->clear();
+
+ qDebug("opening GUTINDEX.ALL file");
+ IDontKnowWhy = "";
+ if ( indexLib.open( IO_ReadOnly) ) { // file opened successfully
+ QTextStream indexStream( &indexLib );
+ QString indexLine;
+ qApp->processEvents();
+ // int jig;
+ while ( !indexStream.eof() ) {
+
+ indexLine = indexStream.readLine();
+ if ( indexLine != "") {
+ if( (indexLine.mid(4,4)).toInt() /* && !( indexLine.left(3)).toInt()*/ ) {
+ // month = indexLine.left( 3);
+ year = indexLine.mid(4,4);
+ // title = indexLine.mid( 9, 50);
+ file = indexLine.mid(60,12);
+ if(file.left(1).find("[",0,TRUE) != -1)
+ file.remove(1,1);
+ if( file.find("]",0,TRUE) != -1)
+ file = file.left( file.find("]",0,TRUE));
+ //qDebug("file is "+file);
+ /// number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 );
+ number = indexLine.mid(55,5);
+ number = number.stripWhiteSpace();
+ // title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() );
+ title = indexLine.mid( 9, 50 );
+ title = title.stripWhiteSpace();
+ //qDebug("title is "+title);
+ getAuthor(); // grok author
+ author = author.stripWhiteSpace();
+ //qDebug("author is "+author);
+ if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author
+ QString lastName, firstName="";
+ int finder=author.findRev( ' ', -1, TRUE);
+ lastName=author.right( author.length()-finder);
+ firstName=author.left(finder);
+ lastName=lastName.stripWhiteSpace();
+ firstName=firstName.stripWhiteSpace();
+
+ if( lastName.find( firstName, 0, true) == -1) // this avoids dup names
+ author=lastName+", "+firstName;
+ }
+
+ if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) /*&& (file.find( "]",0, TRUE))*/ ) {
+ // fill string list or something to be able to sort by Author
+ if( author.isEmpty() )
+ QList_Item5 = new QListViewItem( ListView5, /*number, */title, author, year, file );
+ else {
+ if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) ||
+ (author.left(1) >= QString("a") && author.left(1) <= QString("f")) )
+ QList_Item1 = new QListViewItem( ListView1, /* number,*/ title, author, year, file );
+
+ else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) ||
+ (author.left(1) >= QString("g") && author.left(1) <= QString("m")) )
+ QList_Item2 = new QListViewItem( ListView2, /* number,*/ title, author, year, file );
+
+ else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) ||
+ (author.left(1) >= QString("n") && author.left(1) <= QString("r")) )
+ QList_Item3 = new QListViewItem( ListView3, /* number,*/ title, author, year, file );
+
+ else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) ||
+ (author.left(1) >= QString("s") && author.left(1) <= QString("z")) )
+ QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file );
+ }
+ }
+ }
+ }
+ }
+ indexLib.close();
+ } else {
+ QString sMsg;
+ sMsg = ( tr("Error opening local library index:\n "))+local_index;
+ QMessageBox::message( "Error",sMsg);
+ }
+
+} //end Library()
+
+
+ /*
+ Groks the author out of the title */
+bool LibraryDialog::getAuthor()
+{
+ if( title.contains( ", by", TRUE)) {
+ int auth;
+ auth = title.find(", by", 0, TRUE);
+ author = title.right(title.length() - (auth + 4) );
+ if( int finder = author.find("[", 0, TRUE)) {
+ author = author.left(finder);
+ }
+ }
+ else if ( title.contains( "by, ", TRUE) ) {
+ int auth;
+ auth = title.find("by, ", 0, TRUE);
+ author = title.right(title.length() - (auth + 4) );
+ if( int finder = author.find("[", 0, TRUE)) {
+ author = author.left( finder);
+ }
+ }
+ else if ( title.contains( " by", TRUE) ) {
+ int auth;
+ auth = title.find(" by", 0, TRUE);
+ author = title.right(title.length() - (auth + 3) );
+ if( int finder = author.find("[", 0, TRUE)) {
+ author = author.left( finder);
+ }
+ }
+ else if ( title.contains( "by ", TRUE) ) {
+ int auth;
+ auth = title.find("by ", 0, TRUE);
+ author = title.right(title.length() - (auth + 3) );
+ if( int finder = author.find("[", 0, TRUE)) {
+ author = author.left( finder);
+ }
+ }
+ else if ( title.contains( ",", TRUE) ) {
+ int auth;
+ auth = title.find(",", 0, TRUE);
+ author = title.right( title.length() - (auth + 1) );
+ if ( author.contains( ",", TRUE) ) {
+ int auth;
+ auth = author.find(",", 0, TRUE);
+ author = author.right( author.length() - (auth + 1) );
+ }
+ if( int finder = author.find("[", 0, TRUE)) {
+ author = author.left( finder);
+ }
+ }
+ else if ( title.contains( "/", TRUE) ) {
+ int auth;
+ auth = title.find("/", 0, TRUE);
+ author = title.right(title.length() - (auth + 1) );
+ if( int finder = author.find("[", 0, TRUE)) {
+ author = author.left( finder);
+ }
+ }
+ else if ( title.contains( "of", TRUE) ) {
+ int auth;
+ auth = title.find("of", 0, TRUE);
+ author = title.right(title.length() - (auth + 2) );
+ if( int finder = author.find("[", 0, TRUE))
+ {
+ author = author.left( finder);
+ }
+ } else {
+ author = "";
+ }
+ if ( author.contains("et. al")) {
+ int auth;
+ auth = author.find("et. al", 0, TRUE);
+ author = author.left( auth );
+ }
+ if ( author.contains("#")) {
+ int auth;
+ auth = author.find("#", 0, TRUE);
+ author = author.left( auth);
+ }
+ if ( author.contains("(")) {
+ int auth;
+ auth = author.find("(", 0, TRUE);
+ author = author.left( auth);
+ }
+ if ( author.contains("et al")) {
+ int auth;
+ auth = author.find("et al", 0, TRUE);
+ author = author.left( auth );
+ }
+ QRegExp r = QRegExp("[0-9]", TRUE, FALSE);
+ if ( author.left(2).find( r) != -1 ) {
+ author = "";
+ }
+ // if( author.contains(" ", TRUE)) {
+ // int suth = author.findRev(" ", -1, TRUE);
+ // author = author.right( author.length() - suth);
+ // }
+
+ // title
+ // author
+ return true;
+}////// end getAuthor()
+
+ /*
+ selected one etext*/
+void LibraryDialog::select_title( QListViewItem * item)
+{
+ if(item != NULL) {
+ i++;
+ int index = tabWidget->currentPageIndex();
+ DlglistItemTitle = item->text(0);
+ DlglistItemYear = item->text(2);
+ DlglistItemFile = item->text(3);
+ switch (index) {
+ case 0: {
+ ListView1->clearSelection();
+ }
+ break;
+ case 1: {
+ ListView2->clearSelection();
+ }
+ break;
+ case 2: {
+ ListView3->clearSelection();
+ }
+ break;
+ case 3: {
+ ListView4->clearSelection();
+ }
+ break;
+ case 4: {
+ ListView5->clearSelection();
+ }
+ break;
+ };
+ }
+
+ if(DlglistItemTitle.length()>2) {
+ // DlglistItemNumber = item->text(0);
+ item = 0;
+ qDebug( "string from librarydialog is:%s %s %s", DlglistItemYear.latin1(),DlglistItemFile.latin1(),DlglistItemNumber.latin1());
+ qDebug("Title is "+DlglistItemTitle);
+
+ // check for connection here
+ // if( get_extext())
+
+ if(download_Etext()) {
+ // qDebug("get here 2");
+ if(i_binary == 1) {
+
+ }
+ if(checkBox->isChecked () ) {
+ accept();
+ }
+ }
+ }
+}
+
+bool LibraryDialog::download_Etext()
+{ // ftp method
+ // might have to use old gpl'd ftp for embedded!!
+ Config cfg("Gutenbrowser");
+ cfg.setGroup("FTPsite");
+ ftp_host=cfg.readEntry("SiteName", "sailor.gutenberg.org");
+ ftp_base_dir= cfg.readEntry("base", "/pub/gutenberg");
+
+ qDebug("about to network dialog");
+ QString NewlistItemNumber, NewlistItemYear, ls_result, result_line, s, dir, networkUrl, outputFile;
+
+ //////////////////// FIXME- if 'x' is part of real name....
+ NewlistItemFile = DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).left(DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).find("x", 1, FALSE));
+
+ if( NewlistItemFile.find( DlglistItemFile.left(4) ,0,TRUE) ==-1 ) {
+ NewlistItemFile.replace( 0,4, DlglistItemFile.left(4));
+ qDebug("NewlistItemFile is now "+NewlistItemFile);
+ }
+ NewlistItemYear = DlglistItemYear.right(2);
+ int NewlistItemYear_Int = NewlistItemYear.toInt(0, 10);
+ qDebug(NewlistItemYear);
+ if (NewlistItemYear_Int < 91 && NewlistItemYear_Int > 70) {
+ NewlistItemYear = "90";
+ }
+ Edir ="etext" +NewlistItemYear;
+ dir= ftp_base_dir + "/etext" +NewlistItemYear+"/";
+ if( ftp_base_dir.find("=",0,true) )
+ ftp_base_dir.remove( ftp_base_dir.find("=",0,true),1);
+
+ networkUrl= "ftp://"+ftp_host+dir;
+
+ outputFile=local_library+".guten_temp";
+ //qDebug("Download file:%s",NewlistItemFile.latin1() );
+ qDebug("Checking: "+ftp_host+" "+dir+" "+outputFile+" "+NewlistItemFile);
+ QStringList networkList;
+ networkList.append((const char *)ftp_host);
+ networkList.append((const char *)dir);
+ networkList.append((const char *)outputFile);
+ networkList.append((const char *)NewlistItemFile);
+//<< (char *)ftp_host << (char *)dir << (char *)outputFile << (char *)NewlistItemFile;
+
+ NetworkDialog *NetworkDlg;
+ NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkList);
+
+
+ if( NetworkDlg->exec() != 0 ) { // use new, improved, *INSTANT* network-dialog-file-getterer
+ File_Name= NetworkDlg->localFileName;
+ qDebug("back to Library from Network Dialog");
+ qDebug("Just downloaded "+NetworkDlg->localFileName);
+
+ // if (File_Name.find( local_library, 0, TRUE) != -1 ) { //could not be found
+ // QString oldName=File_Name;
+ // File_Name.replace(0,local_library.length(),downDir);
+ // qDebug("File_Name now is "+File_Name);
+
+ // }
+ // rename .txt to .etx
+ if(NetworkDlg->successDownload) {
+ qDebug("Filename is "+File_Name);
+ if(File_Name.right(4)==".txt") {
+ QString s_fileName=File_Name;
+ s_fileName.replace( s_fileName.length()-3,3,"gtn");
+ // s_fileName.replace( s_fileName.length()-3,3,"etx");
+ rename(File_Name.latin1(),s_fileName.latin1());
+ File_Name=s_fileName;
+
+ qDebug("Filename is now "+File_Name);
+
+ }
+ if(File_Name.length() > 5 ) {
+ setTitle();
+ QFileInfo fi(File_Name);
+ QString 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 "+DlglistItemTitle);
+ lnk.setComment(DlglistItemTitle);
+
+ qDebug("Filename is "+File_Name);
+ lnk.setFile(File_Name); //sets File property
+ lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D
+ lnk.setExec(File_Name);
+ lnk.setIcon("gutenbrowser/Gutenbrowser");
+ if(!lnk.writeLink()) {
+ qDebug("Writing doclink did not work");
+ } else {
+ }
+ } else
+ QMessageBox::message("Note","There was an error\nwith the file");
+ }
+ }
+ return true;
+}
+
+bool LibraryDialog::httpDownload()
+{// httpDownload
+#ifndef Q_WS_QWS
+ Config config("Gutenbrowser");
+ config.setGroup( "Browser" );
+ QString brow = config.readEntry("Preferred", "");
+ QString file_name = "./.guten_temp";
+ // config.setGroup( "HttpServer" );
+ // QString s_http = config.readEntry("Preferred", "http://sailor.gutenbook.org");
+ QString httpName = proxy_http + "/"+Edir;
+ // progressBar->setProgress( i);
+ i++;
+ if ( brow != "Konq") { /////////// use lynx
+ // QString cmd = "lynx -source " + httpName +" | cat >> " + file_name;
+ // system(cmd);
+ } else { //////////// use KFM
+ // KFM::download( httpName, file_name);
+ }
+ i++;
+ QFile tmp( file_name);
+ QString str;
+ if (tmp.open(IO_ReadOnly)) {
+ QTextStream t( &tmp ); // use a text stream
+ while ( !t.eof()) {
+ QString s = t.readLine();
+ if (s.contains( NewlistItemFile, FALSE) && (s.contains(".txt")) ) {
+ str = s.mid( s.find( ".txt\">"+NewlistItemFile, 0, TRUE)+6, (s.find( ".txt</A>", 0, TRUE) + 4) - ( s.find( ".txt\">"+NewlistItemFile, 0, TRUE)+6 ) );
+ httpName += "/" + str;
+ }
+ } //end of while loop
+ }
+ tmp.close();
+ m_getFilePath = local_library + str;
+ i++;
+ if ( brow != "KFM"){ ///////// use lynx
+ QString cmd = "lynx -source " + httpName +" | cat >> " + m_getFilePath;
+ // QMessageBox::message("Error", cmd);
+ system(cmd);
+ } else { ////////// use KFM
+ // KFM::download( httpName, m_getFilePath);
+ }
+ i++;
+#endif
+ return false;
+}
+
+void LibraryDialog::cancelIt()
+{
+ saveConfig();
+
+ DlglistItemNumber = "";
+ this->reject();
+}
+
+bool LibraryDialog::setTitle()
+{
+ Config config("Gutenbrowser");
+ qDebug("setting title");
+ qDebug(DlglistItemTitle);
+
+ if( DlglistItemTitle.find("[",0,TRUE) != -1)
+ DlglistItemTitle.replace(DlglistItemTitle.find("[",0,TRUE),1, "(" );
+ if( DlglistItemTitle.find("]",0,TRUE) !=-1)
+ DlglistItemTitle.replace(DlglistItemTitle.find("]",0,TRUE),1, ")" );
+ qDebug("Title being set is "+DlglistItemTitle);
+ int test = 0;
+ QString ramble, temp;
+ config.setGroup("Files");
+ QString s_numofFiles = config.readEntry("NumberOfFiles", "0" );
+ int i_numofFiles = s_numofFiles.toInt();
+ for ( int i = 0; i <= i_numofFiles; i++){
+ temp.setNum( i);
+ ramble = config.readEntry( temp, "" );
+ if( strcmp( ramble, File_Name) == 0){
+ test = 1;
+ }
+ }
+ config.setGroup("Files");
+ config.writeEntry( "NumberOfFiles", i_numofFiles +1 );
+ QString interger;
+ interger.setNum( i_numofFiles +1);
+ config.writeEntry( interger, File_Name);
+ config.setGroup( "Titles" );
+ config.writeEntry( File_Name, DlglistItemTitle);
+
+ test = 0;
+ return true;
+}
+
+
+void LibraryDialog::saveConfig()
+{
+ Config config("Gutenbrowser");
+ if( httpBox->isChecked() == TRUE) {
+ checked = 1;
+ config.setGroup( "Proxy" );
+ config.writeEntry("IsChecked", "TRUE");
+ } else {
+ checked = 0;
+ config.setGroup( "Proxy" );
+ config.writeEntry("IsChecked", "FALSE");
+ }
+ if (authBox->isChecked() == TRUE) {
+ config.setGroup("SortAuth");
+ config.writeEntry("authSort", "TRUE");
+ } else {
+ config.setGroup("SortAuth");
+ config.writeEntry("authSort", "FALSE");
+ }
+ // config.write();
+}
+
+ /*
+ searches library index for user word*/
+void LibraryDialog::onButtonSearch()
+{
+ ListView1->clearSelection();
+ ListView2->clearSelection();
+ ListView3->clearSelection();
+ ListView4->clearSelection();
+ ListView5->clearSelection();
+
+ int curTab=tabWidget->currentPageIndex();
+ SearchDialog* searchDlg;
+
+ // if( resultsList)
+ searchDlg = new SearchDialog( this, "Library Search", TRUE);
+ searchDlg->setCaption( tr( "Library Search" ) );
+ searchDlg->setLabel( "- author or title");
+ QString resultString;
+ int i_berger = 0;
+ if( searchDlg->exec() != 0 ) {
+ QString searcherStr = searchDlg->get_text();
+ int fluff=0;
+
+ // int tabPage = tabWidget->currentPageIndex();
+ // TODO ititerate here... struct<listViews>??
+
+ QListViewItemIterator it1( ListView1 );
+ QListViewItemIterator it2( ListView2 );
+ QListViewItemIterator it3( ListView3 );
+ QListViewItemIterator it4( ListView4 );
+ QListViewItemIterator it5( ListView5 );
+
+ //// this is really pitiful work,
+ ///////
+ bool cS;
+ if( searchDlg->caseSensitiveCheckBox->isChecked())
+ cS=true; //case sensitive
+ else
+ cS=false;
+
+ if(fluff==0) {
+ for ( ; it1.current(); ++it1 ) {
+ resultString = ( it1.current() )->text(0);
+ resultString += (" : ");
+ resultString += ( it1.current() )->text(2);
+ resultString += (" : ");
+ resultString += ( it1.current() )->text(3);
+ if( resultString.find( searcherStr, 0, cS) != -1)
+ {
+ Searchlist.append( resultString);
+ }
+ }
+ }
+ if(fluff==0) {// search routine here
+ for ( ; it2.current(); ++it2 ) {
+ resultString = ( it2.current() )->text(0);
+ resultString += (" : ");
+ resultString += ( it2.current() )->text(2);
+ resultString += (" : ");
+ resultString += ( it2.current() )->text(3);
+ if( resultString.find( searcherStr, 0, cS) != -1) {
+ Searchlist.append( resultString);
+ }
+ }
+ }
+ if(fluff==0) {// search routine here
+ for ( ; it3.current(); ++it3 ) {
+ resultString = ( it3.current() )->text(0);
+ resultString += (" : ");
+ resultString += ( it3.current() )->text(2);
+ resultString += (" : ");
+ resultString += ( it3.current() )->text(3);
+
+ if( resultString.find( searcherStr, 0, cS) != -1) {
+ Searchlist.append( resultString);
+ }
+ }
+ }
+ if(fluff==0) {
+ // search routine here
+ for ( ; it4.current(); ++it4 ) {
+ resultString = ( it4.current() )->text(0);
+ resultString += (" : ");
+ resultString += ( it4.current() )->text(2);
+ resultString += (" : ");
+ resultString += ( it4.current() )->text(3);
+ if( resultString.find( searcherStr, 0, cS) != -1) {
+ Searchlist.append( resultString);
+ }
+ }
+ }
+ if(fluff==0) { // search routine here
+ for ( ; it5.current(); ++it5 ) {
+ resultString = ( it5.current() )->text(0);
+ resultString += (" : ");
+ resultString += ( it5.current() )->text(2);
+ resultString += (" : ");
+ resultString += ( it5.current() )->text(3);
+ if( resultString.find( searcherStr, 0, cS) != -1) {
+ Searchlist.append( resultString);
+ }
+ }
+ }
+
+ tabWidget->setCurrentPage( curTab);
+
+ Searchlist.sort();
+ SearchResultsDlg* SearchResultsDialog;
+ SearchResultsDialog = new SearchResultsDlg( searchDlg, "Results Dialog", true, 0 , Searchlist);
+
+ SearchResultsDialog->showMaximized();
+ if( SearchResultsDialog->exec() != 0) {
+ texter = SearchResultsDialog->selText;
+ // qDebug(texter);
+ resultLs= SearchResultsDialog->resultsList;
+ i_berger = 1;
+ }
+ Searchlist.clear();
+
+ // if(SearchResultsDialog)
+ // delete SearchResultsDialog;
+ QString tester;
+ for ( QStringList::Iterator it = resultLs.begin(); it != resultLs.end(); ++it ) {
+ texter.sprintf("%s \n",(*it).latin1());
+ // qDebug(texter);
+ if( tester!=texter)
+ parseSearchResults( texter);
+ tester = texter;
+ }
+ if(searchDlg)
+ delete searchDlg;
+ }
+ if(checkBox->isChecked() ) {
+ accept();
+ } else {
+ setActiveWindow();
+ }
+}
+
+ /*
+ splits the result string and calls download for the current search result*/
+void LibraryDialog::parseSearchResults( QString resultStr)
+{
+
+ int stringLeng=resultStr.length();
+ QString my;
+ my.setNum( stringLeng, 10);
+
+ if( resultStr.length() > 2 && resultStr.length() < 130) {
+ int titleInt = resultStr.find( " : ", 0, TRUE);
+ DlglistItemTitle = resultStr.left( titleInt);
+ int yearInt = resultStr.find( " : ", titleInt+3, TRUE);
+ DlglistItemYear = resultStr.mid( titleInt+3, (yearInt - titleInt)-3);
+ DlglistItemFile = resultStr.right( resultStr.length() - (yearInt + 3));
+ download_Etext();
+ }
+ /*
+ printf( DlglistItemTitle+"\n"); printf( DlglistItemYear+"\n"); printf( DlglistItemFile+"\n");*/
+}
+
+ // bool LibraryDialog::UnzipIt( QString zipFile) {
+ // //////////TODO findsome other way of dealingwithzip files.
+ // ///usr/bin/unzip";
+ // if( QFile::exists( zipFile)) {
+ // // QString thatFile = local_library +"PGWHOLE.TXT";
+ // QString cmd;
+ // #if defined(_WS_X11_)
+ // cmd = "gunzip -d " + zipFile /*newestLibraryFile */+" -d " + local_library;
+ // #endif
+ // #if defined(_WS_WIN_)
+ // QString temp= QDir::convertSeparators(local_library);
+ // zipFile=QDir::convertSeparators( zipFile);
+ // cmd = temp+"unzip.exe -o " +zipFile/*newestLibraryFile */+" -d " + temp;
+ // #endif
+ // #ifndef Q_WS_QWS
+ // // QString cmd = "gunzip -d " + zipFile /*newestLibraryFile */+" -d " + local_library;
+ // cmd = "unzip " + zipFile;
+ // #endif
+
+ // int exit=QMessageBox::information(this, "Unzip?", "Ok to unzip "+ zipFile+" ?", QMessageBox::Yes, QMessageBox::No);
+ // if (exit==QMessageBox::Yes) {
+ // qDebug("Issuing the command "+cmd);
+ // #if defined(_WS_WIN_)
+ // WinExec( cmd, SW_HIDE );
+ // #endif
+ // #if defined(_WS_X11_)
+ // system( cmd);
+ // #endif
+ // #ifndef Q_WS_QWS
+ // system( cmd);
+ // #endif
+ // // printf("unzip\n");
+ // // remove( zipFile /*newestLibraryFile*/);
+ // return true;
+ // }
+ // else if(exit==QMessageBox::No) {
+ // // printf("unzip\n");
+ // return false;
+ // }
+ // } else {
+ // // QMessageBox::message( "Note",( tr("Please install unzip in your PATH")) );
+ // return false;
+ // }
+ // return true;
+ // }
+
+void LibraryDialog::sort()
+{
+
+}
+
+ /*
+ Downloads the current selected listitem*/
+bool LibraryDialog::getItem(QListViewItem *it)
+{
+ // qDebug("selected getItem");
+
+ // DlglistItemNumber = it->text(0);
+ DlglistItemTitle = it->text(0);
+ DlglistItemYear = it->text(2);
+ DlglistItemFile = it->text(3);
+
+ if(download_Etext()) {
+ if(i_binary == 1) {
+ }
+ }
+ return true;
+}
+
+ /*
+ download button is pushed so we get the current items to download*/
+bool LibraryDialog::onButtonDownload()
+{
+ // qDebug("selected onButtonDownloadz");
+
+ QListViewItemIterator it1( ListView1 );
+ QListViewItemIterator it2( ListView2 );
+ QListViewItemIterator it3( ListView3 );
+ QListViewItemIterator it4( ListView4 );
+ QListViewItemIterator it5( ListView5 );
+
+ // iterate through all items of the listview
+ for ( ; it1.current(); ++it1 ) {
+ if ( it1.current()->isSelected() )
+ getItem(it1.current());
+ it1.current()->setSelected(FALSE);
+ }
+ for ( ; it2.current(); ++it2 ) {
+ if ( it2.current()->isSelected() )
+ getItem(it2.current());
+ it2.current()->setSelected(FALSE);
+ }
+ for ( ; it3.current(); ++it3 ) {
+ if ( it3.current()->isSelected() )
+ getItem(it3.current());
+ it3.current()->setSelected(FALSE);
+ }
+ for ( ; it4.current(); ++it4 ) {
+ if ( it4.current()->isSelected() )
+ getItem(it4.current());
+ it4.current()->setSelected(FALSE);
+ }
+ for ( ; it5.current(); ++it5 ) {
+ if ( it5.current()->isSelected() )
+ getItem(it5.current());
+ it5.current()->setSelected(FALSE);
+ }
+ return true;
+}
+
+
+ /*
+ handles the sorting combo box */
+void LibraryDialog::comboSelect(int index)
+{
+ // qDebug("we are sorting");
+ ListView1->setSorting( index, TRUE);
+ ListView2->setSorting( index, TRUE);
+ ListView3->setSorting( index, TRUE);
+ ListView4->setSorting( index, TRUE);
+ ListView5->setSorting( index, TRUE);
+
+ ListView1->sort();
+ ListView2->sort();
+ ListView3->sort();
+ ListView4->sort();
+ ListView5->sort();
+
+ // ListView1->triggerUpdate();
+ // ListView2->triggerUpdate();
+ // ListView3->triggerUpdate();
+ // ListView4->triggerUpdate();
+ // ListView5->triggerUpdate();
+}
+
+void LibraryDialog::newList()
+{
+ if(indexLoaded) {
+ onButtonDownload();
+ } else {
+ Output *outDlg;
+ buttonNewList->setDown(TRUE);
+ QDir gutDir(QPEApplication::qpeDir()+"etc/gutenbrowser");
+ if(!gutDir.exists()) gutDir.mkdir(QPEApplication::qpeDir()+"etc/gutenbrowser",true);
+ if( chdir(QPEApplication::qpeDir()+"etc/gutenbrowser") == 0) {
+ qDebug("changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser");
+ QString gutenindex1 = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL";
+ QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1";
+
+ int result = QMessageBox::warning( this,"Download"
+ ,"Ok to use /'wget/' to download\na new library list?\n"
+ ,"Yes","No",0,0,1);
+ qApp->processEvents();
+ if(result == 0) {
+ outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),TRUE);
+ outDlg->showMaximized();
+ outDlg->show();
+ qApp->processEvents();
+ FILE *fp;
+ char line[130];
+ outDlg->OutputEdit->append( tr("Running wget") );
+ outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
+ sleep(1);
+ fp = popen( (const char *) cmd, "r");
+ if ( !fp ) {
+ } else {
+ qDebug("Issuing the command\n"+cmd);
+ // system(cmd);
+ while ( fgets( line, sizeof line, fp)) {
+ outDlg->OutputEdit->append(line);
+ outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
+ }
+ pclose(fp);
+ outDlg->OutputEdit->append("Finished downloading\n");
+ outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
+ qApp->processEvents();
+
+ // if( QFile(gutenindex1).exists() ) {
+ // QString gutenindex=QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL";
+ // if( rename(gutenindex1.latin1(),gutenindex.latin1()) !=0)
+ // qDebug("renaming error");
+ // }
+
+ }
+ // outDlg->close();
+ FindLibrary();
+ if(outDlg) delete outDlg;
+ }
+ buttonNewList->setDown(FALSE);
+ } else {
+ QMessageBox::message("Note","Could not change directories");
+ }
+ // if(outDlg)
+ // delete outDlg;
+ }
+}
+
+bool LibraryDialog::moreInfo()
+{
+
+ QListViewItem * item;
+ item = 0;
+ QString titleString;
+ item = ListView1->currentItem();
+ if( item != 0) {
+ titleString = item->text(0);
+ ListView1->clearSelection();
+ item = 0;
+ }
+ if( item == 0)
+ item = ListView2->currentItem();
+ if( item != 0) {
+ titleString = item->text(0);
+ ListView2->clearSelection();
+ item = 0;
+ }
+ if( item == 0)
+ item = ListView3->currentItem();
+ if( item != 0) {
+ titleString = item->text(0);
+ ListView3->clearSelection();
+ item = 0;
+ }
+ if( item == 0)
+ item = ListView4->currentItem();
+ if( item != 0) {
+ titleString = item->text(0);
+ ListView4->clearSelection();
+ item = 0;
+ }
+ if( item == 0)
+ item = ListView5->currentItem();
+ if( item != 0) {
+ titleString = item->text(0);
+ ListView5->clearSelection();
+ item = 0;
+ }
+ item=0;
+ if(titleString.length()>2) {
+ qDebug( "Title is "+titleString );
+ titleString.replace( QRegExp("\\s"), "%20");
+ titleString.replace( QRegExp("'"), "%20");
+ titleString.replace( QRegExp("\""), "%20");
+ titleString.replace( QRegExp("&"), "%20");
+ QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search";
+ cmd="opera "+cmd;
+ system(cmd);
+ } else
+ QMessageBox::message( "Note","If you select a title, this will\nsearch google.com for that title.");
+ return true;
+
+}
+
+ /*
+ This loads the library Index*/
+void LibraryDialog::FindLibrary()
+{
+ buttonLibrary->setDown(TRUE);
+
+ qApp->processEvents();
+ if( QFile( new_index).exists() /* && this->isHidden() */) {
+ newindexLib.setName( new_index);
+ indexLib.setName( new_index);
+ qDebug("index file is "+ new_index);
+ Newlibrary();
+ } else {
+ newindexLib.setName( old_index);
+ indexLib.setName( old_index);
+ qDebug("new index nameis "+ old_index);
+ Library();
+ }
+ indexLoaded=true;
+ buttonSearch->setEnabled(TRUE);
+ moreInfoButton->setEnabled(TRUE);
+
+ buttonLibrary->setDown(FALSE);
+ buttonNewList->setText("Download");
+ qApp->processEvents();
+
+}
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.h b/noncore/apps/opie-gutenbrowser/LibraryDialog.h
new file mode 100644
index 0000000..f5bfe08
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.h
@@ -0,0 +1,126 @@
+/***************************************************************************
+ LibraryDialog.h - description
+ -------------------
+ begin : Sat Aug 19 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+ * 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. *
+ ***************************************************************************/
+#ifndef LIBRARYDIALOG_H
+#define LIBRARYDIALOG_H
+
+#include <qpe/config.h>
+
+#include "SearchDialog.h"
+#include "NetworkDialog.h"
+#include <qstringlist.h>
+#include <qdialog.h>
+#include <qcheckbox.h>
+#include <qdatetime.h>
+#include <qfile.h>
+#include <qheader.h>
+#include <qlistview.h>
+#include <qmessagebox.h>
+#include <qregexp.h>
+#include <qstring.h>
+#include <qtextstream.h>
+#include <qlabel.h>
+#include <stdlib.h>
+#include <qtabwidget.h>
+
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QListView;
+class QListViewItem;
+class QPushButton;
+//class QTabWidget;
+class QWidget;
+//class Gutenbrowser;
+
+class LibraryDialog : public QDialog {
+ Q_OBJECT
+
+public:
+ LibraryDialog( QWidget* parent = 0, const char* name = 0 , bool modal = TRUE, WFlags fl = 0 );
+ ~LibraryDialog();
+
+ QTabWidget *tabWidget;
+ QListView *ListView1,*ListView2,*ListView3,*ListView4,*ListView5;
+ QWidget *widget_1,*widget_2,*widget_3,*widget_4,*widget_5,*widget_6;
+ QString ftp_host,ftp_base_dir;
+ QLabel *statusLabel;
+ QListViewItem *QList_Item1,*QList_Item2,*QList_Item3,*QList_Item4,*QList_Item5;
+ QStringList list,ItemStrlist,Searchlist,resultLs;
+// QStringList list1,list2,list3,list4;
+
+ QPushButton *buttonSearch,*buttonCancel,*buttonDownload,*buttonLibrary,*buttonNewList,*moreInfoButton;
+ QString new_index,old_index;
+ QFile newindexLib,indexLib;
+
+ int checked;
+ int i_binary;
+ bool useSmallInterface;
+bool indexLoaded;
+ QPushButton *cancel,*DownloadAll;
+ QCheckBox *checkBox,*httpBox,*authBox;
+// QCheckBox * httpBox;
+
+ QString filename;
+ QString downDir;
+ int ftpNumb;
+ int i;
+ QString year,title,number,file,author;
+ QString DlglistItemNumber,DlglistItemFile,DlglistItemYear,DlglistItemTitle,NewlistItemFile;
+ QString m_getFilePath;
+ QString Edir;
+
+ QString index;
+ QString IDontKnowWhy;
+ QString local_library;
+ QString local_index;
+ QString File_Name;
+ QString proxy_http;
+ int doitAll;
+ QString texter;
+// CConfigFile *config;
+ void parseSearchResults( QString resultStr);
+
+public slots:
+ bool getItem(QListViewItem* );
+ void doListView();
+ void FindLibrary();
+ void newList();
+ void Newlibrary();
+ void Library();
+ bool getAuthor();
+ void select_title(QListViewItem*);
+ void cancelIt();
+ void sort();
+ bool moreInfo();
+// void DownloadEmAll();
+ bool httpDownload();
+ bool setTitle();
+ void saveConfig();
+ bool download_Etext();
+ void onButtonSearch();
+ bool onButtonDownload();
+
+// bool UnzipIt( QString fileName);
+ void comboSelect(int index);
+protected slots:
+
+
+protected:
+
+ void initDialog();
+ QHBoxLayout *hbox,*hbox1,*hbox2;
+ QVBoxLayout *vbox;
+// void search_slot();
+
+};
+
+#endif // LIBRARYDIALOG_H
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.o b/noncore/apps/opie-gutenbrowser/LibraryDialog.o
new file mode 100644
index 0000000..d8dcaa8
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.o
Binary files differ
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp
new file mode 100644
index 0000000..72d605e
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp
@@ -0,0 +1,281 @@
+/***************************************************************************
+LibraryDialogData.cpp - description
+ begin : Sat Dec 4 1999
+ begin : Tue Jul 25 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+***************************************************************************/
+/***************************************************************************
+ * *
+ * 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 "LibraryDialog.h"
+#include <qpe/config.h>
+
+#include <qpushbutton.h>
+#include <qtabwidget.h>
+#include <qwidget.h>
+#include <qlayout.h>
+
+#include <qimage.h>
+#include <qpixmap.h>
+#include <qlistview.h>
+#include <qpushbutton.h>
+#include <qtooltip.h>
+#include <qdialog.h>
+#include <qcheckbox.h>
+#include <qdatetime.h>
+#include <qfile.h>
+#include <qheader.h>
+#include <qlistview.h>
+#include <qmessagebox.h>
+#include <qregexp.h>
+#include <qstring.h>
+#include <qtextstream.h>
+#include <qprogressbar.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qcombobox.h>
+
+
+void LibraryDialog::initDialog(){
+
+
+ QGridLayout *layout = new QGridLayout( this );
+ layout->setSpacing(2);
+ layout->setMargin(4);
+
+ tabWidget = new QTabWidget( this, "tabWidget" );
+ layout->addMultiCellWidget( tabWidget, 0, 0, 0, 3);
+
+ widget_1 = new QWidget( tabWidget, "widget" );
+ ListView1 = new QListView( widget_1, "ListView1" );
+ QGridLayout *layout1 = new QGridLayout(widget_1 );
+
+ widget_2 = new QWidget( tabWidget, "widget_2" );
+ ListView2 = new QListView( widget_2, "ListView2" );
+ QGridLayout *layout2 = new QGridLayout(widget_2 );
+
+ widget_3 = new QWidget( tabWidget, "widget_3" );
+ ListView3 = new QListView( widget_3, "ListView3" );
+ QGridLayout *layout3 = new QGridLayout(widget_3 );
+
+ widget_4 = new QWidget( tabWidget, "widget_4" );
+ ListView4 = new QListView( widget_4, "ListView4" );
+ QGridLayout *layout4 = new QGridLayout(widget_4 );
+
+ widget_5 = new QWidget( tabWidget, "widget_5" );
+ ListView5 = new QListView( widget_5, "ListView5" );
+ QGridLayout *layout5 = new QGridLayout(widget_5 );
+
+
+ ListView1->addColumn( tr( "Title" ) );
+ ListView1->setColumnWidthMode( 0, QListView::Manual );
+ ListView1->setColumnWidth(0, 330);
+ ListView1->setColumnAlignment( 0, 1 );
+
+ ListView1->addColumn( tr( "Author" ) );
+ ListView1->setColumnWidthMode( 1, QListView::Manual );
+ ListView1->setColumnWidth(1, 170);
+ ListView1->setColumnAlignment( 1, 1 );
+
+ ListView1->addColumn( tr( "Year" ) );
+ ListView1->setColumnWidthMode( 2, QListView::Manual );
+ ListView1->setColumnWidth(2, 50);
+ ListView1->setColumnAlignment( 2, 1 );
+
+ ListView1->addColumn( tr( "File" ) );
+ ListView1->setColumnWidthMode( 2, QListView::Manual );
+ ListView1->setColumnWidth(2, 100);
+ ListView1->setColumnAlignment( 2, 1 );
+
+ ListView2->addColumn( tr( "Title" ) );
+ ListView2->setColumnWidthMode( 0, QListView::Manual );
+ ListView2->setColumnWidth(0, 330);
+ ListView2->setColumnAlignment( 0, 1 );
+
+ ListView2->addColumn( tr( "Author" ) );
+ ListView2->setColumnWidthMode( 1, QListView::Manual );
+ ListView2->setColumnWidth(1, 170);
+ ListView2->setColumnAlignment( 1, 1 );
+
+ ListView2->addColumn( tr( "Year" ) );
+ ListView2->setColumnWidthMode( 2, QListView::Manual );
+ ListView2->setColumnWidth(2, 50);
+ ListView2->setColumnAlignment( 2, 1 );
+
+ ListView2->addColumn( tr( "File" ) );
+ ListView2->setColumnWidthMode( 3, QListView::Manual );
+ ListView2->setColumnWidth(3, 100);
+ ListView2->setColumnAlignment( 3, 1 );
+
+ ListView3->addColumn( tr( "Title" ) );
+ ListView3->setColumnWidthMode( 0, QListView::Manual );
+ ListView3->setColumnWidth(0, 330);
+ ListView3->setColumnAlignment( 0, 1 );
+
+ ListView3->addColumn( tr( "Author" ) );
+ ListView3->setColumnWidthMode( 1, QListView::Manual );
+ ListView3->setColumnWidth(1, 170);
+ ListView3->setColumnAlignment( 1, 1 );
+
+ ListView3->addColumn( tr( "Year" ) );
+ ListView3->setColumnWidthMode( 2, QListView::Manual );
+ ListView3->setColumnWidth(2, 50);
+ ListView3->setColumnAlignment( 2, 1 );
+
+ ListView3->addColumn( tr( "File" ) );
+ ListView3->setColumnWidthMode( 3, QListView::Manual );
+ ListView3->setColumnWidth(3, 100);
+ ListView3->setColumnAlignment( 3, 1 );
+
+
+ ListView4->addColumn( tr( "Title" ) );
+ ListView4->setColumnWidthMode( 0, QListView::Manual );
+ ListView4->setColumnWidth(0, 330);
+ ListView4->setColumnAlignment( 0, 1 );
+
+ ListView4->addColumn( tr( "Author" ) );
+ ListView4->setColumnWidthMode( 1, QListView::Manual );
+ ListView4->setColumnWidth(1, 170);
+ ListView4->setColumnAlignment( 1, 1 );
+
+ ListView4->addColumn( tr( "Year" ) );
+ ListView4->setColumnWidthMode( 2, QListView::Manual );
+ ListView4->setColumnWidth(2, 50);
+ ListView4->setColumnAlignment( 2, 1 );
+
+ ListView4->addColumn( tr( "File" ) );
+ ListView4->setColumnWidthMode( 3, QListView::Manual );
+ ListView4->setColumnWidth(3, 100);
+ ListView4->setColumnAlignment( 3, 1 );
+
+ ListView5->addColumn( tr( "Title" ) );
+ ListView5->setColumnWidthMode( 0, QListView::Manual );
+ ListView5->setColumnWidth(0, 330);
+ ListView5->setColumnAlignment( 0, 1 );
+
+ ListView5->addColumn( tr( "Author" ) );
+ ListView5->setColumnWidthMode( 1, QListView::Manual );
+ ListView5->setColumnWidth(1, 170);
+ ListView5->setColumnAlignment( 1, 1 );
+
+ ListView5->addColumn( tr( "Year" ) );
+ ListView5->setColumnWidthMode( 2, QListView::Manual );
+ ListView5->setColumnWidth(2, 50);
+ ListView5->setColumnAlignment( 2, 1 );
+
+ ListView5->addColumn( tr( "File" ) );
+ ListView5->setColumnWidthMode( 3, QListView::Manual );
+ ListView5->setColumnWidth(3, 100);
+ ListView5->setColumnAlignment( 3, 1 );
+
+ tabWidget->insertTab( widget_1, tr( "A-F" ) );
+ tabWidget->insertTab( widget_2, tr( "G-M" ) );
+ tabWidget->insertTab( widget_3, tr( "N-R" ) );
+ tabWidget->insertTab( widget_4, tr( "S-Z" ) );
+ tabWidget->insertTab( widget_5, tr( " " ) );
+
+ ListView1->setMultiSelection(TRUE);
+ ListView2->setMultiSelection(TRUE);
+ ListView3->setMultiSelection(TRUE);
+ ListView4->setMultiSelection(TRUE);
+ ListView5->setMultiSelection(TRUE);
+
+ widget_6 = new QWidget( tabWidget, "widget_6" );
+ tabWidget->insertTab(widget_6,tr("Options"));
+
+ ListView1->setSorting( 2, TRUE);
+ ListView2->setSorting( 2, TRUE);
+ ListView3->setSorting( 2, TRUE);
+ ListView4->setSorting( 2, TRUE);
+ ListView5->setSorting( 2, TRUE);
+ ListView1->setAllColumnsShowFocus( TRUE );
+ ListView2->setAllColumnsShowFocus( TRUE );
+ ListView3->setAllColumnsShowFocus( TRUE );
+ ListView4->setAllColumnsShowFocus( TRUE );
+ ListView5->setAllColumnsShowFocus( TRUE );
+
+ QGridLayout *layout6 = new QGridLayout(widget_6 );
+ QComboBox * sortingCombo;
+ buttonCancel = new QPushButton( widget_6, "buttonCancel" );
+ checkBox = new QCheckBox( ( tr("Open Automatically")), widget_6);
+ checkBox->setChecked( FALSE);
+// httpBox = new QCheckBox( ( tr("Use http")),widget_6);
+// httpBox->setChecked( FALSE);
+// QToolTip::add( httpBox, ( tr("Use http to download \nproxy users should probably use this.")) );
+ authBox= new QCheckBox( ( tr("Last name first \n(requires library restart)")),widget_6);
+ authBox->setChecked( FALSE);
+
+ layout1->addMultiCellWidget( ListView1, 0, 0, 0, 4);
+ layout2->addMultiCellWidget( ListView2, 0, 0, 0, 4);
+ layout3->addMultiCellWidget( ListView3, 0, 0, 0, 4);
+ layout4->addMultiCellWidget( ListView4, 0, 0, 0, 4);
+ layout5->addMultiCellWidget( ListView5, 0, 0, 0, 4);
+
+ buttonSearch = new QPushButton(this,"buttonSearch");
+ buttonLibrary=new QPushButton(this,"buttenLibrary");
+ buttonNewList=new QPushButton(this,"NewList");
+ moreInfoButton= new QPushButton(this,"moreInfo");
+ sortingCombo=new QComboBox(widget_6,"sort by combo");
+
+
+ layout6->addMultiCellWidget(buttonCancel, 0, 0, 4, 4);
+ layout6->addMultiCellWidget(checkBox, 1, 1, 0, 0);
+ layout6->addMultiCellWidget(sortingCombo, 2, 2, 0, 0);
+ layout6->addMultiCellWidget(authBox, 3, 3, 0, 0);
+
+ layout->addMultiCellWidget( buttonSearch, 1, 1, 0, 0);
+ layout->addMultiCellWidget( buttonLibrary, 1, 1, 1, 1);
+ layout->addMultiCellWidget( moreInfoButton, 1, 1, 2, 2);
+ layout->addMultiCellWidget( buttonNewList, 1, 1, 3, 3);
+
+ moreInfoButton->setText("Info");
+ moreInfoButton->setDisabled(TRUE);
+ buttonSearch->setDisabled(TRUE);
+
+ buttonSearch->setText(tr("Search"));
+
+ buttonCancel->setText(tr("Close"));
+ buttonLibrary->setText("Load");
+ buttonLibrary->setDefault(TRUE);
+ buttonNewList->setText("New List");
+
+ QStrList sortingList;
+ sortingList.append( "Sort by Number");
+ sortingList.append("Sort by Title");
+ sortingList.append( "Sort by Author");
+ sortingList.append("Sort by Year");
+
+ sortingCombo->insertStrList(sortingList,0);
+ sortingCombo->setCurrentItem(2);
+ sortingCombo->setMaximumWidth(180);
+
+ // signals and slots connections
+ connect(buttonSearch,SIGNAL(clicked()),this,SLOT(onButtonSearch()));
+ connect(buttonLibrary,SIGNAL(clicked()),this,SLOT(FindLibrary()));
+ connect(buttonCancel,SIGNAL(clicked()),this,SLOT(reject()));
+ connect(moreInfoButton,SIGNAL(clicked()),this,SLOT(moreInfo()));
+ connect(buttonNewList,SIGNAL(clicked()),this,SLOT(newList()));
+
+ connect(ListView1,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*)));
+ connect(ListView1,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*)));
+ connect(ListView2,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*)));
+ connect(ListView2,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*)));
+ connect(ListView3,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*)));
+ connect(ListView3,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*)));
+ connect(ListView4,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*)));
+ connect(ListView4,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*)));
+ connect(ListView5,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*)));
+ connect(ListView5,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*)));
+
+ connect(sortingCombo,SIGNAL(activated(int)),SLOT(comboSelect(int)));
+
+}
+
+void LibraryDialog::doListView() {
+
+}
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialogData.o b/noncore/apps/opie-gutenbrowser/LibraryDialogData.o
new file mode 100644
index 0000000..b9323c0
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialogData.o
Binary files differ
diff --git a/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp b/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp
new file mode 100644
index 0000000..e8ade87
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp
@@ -0,0 +1,329 @@
+// /***************************************************************************
+// NetworkDialog.cpp - description
+// begin : Sun Aug 27 2000
+// copyright : (C) 2000 - 2004 by L.J. Potter
+// email : ljp@llornkcor.com
+// * 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. *
+// ***************************************************************************/
+// // half-assed attempt at providing a network dialog.
+// /* Created: Sun Aug 27 15:24:52 2000*/
+#include <unistd.h>
+extern "C" {
+#include "../../net/ftplib/ftplib.h"
+}
+
+
+#include "NetworkDialog.h"
+#include "gutenbrowser.h"
+
+#include <qprogressbar.h>
+#include <qstringlist.h>
+#include <qpe/config.h>
+#include <qvaluelist.h>
+#include <qapplication.h>
+#include <qfile.h>
+#include <qstringlist.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+
+QProgressBar* ProgressBar1;
+QPushButton* buttonCancel;
+static netbuf *conn = NULL;
+
+static int log_progress(netbuf *ctl, int xfered, void *arg) {
+ int fsz = *(int *)arg;
+ int pct = (xfered * 100) / fsz;
+ printf("%3d%%\r", pct);
+ fflush(stdout);
+ ProgressBar1->setProgress(xfered);
+ qApp->processEvents();
+
+ return 1;
+}
+
+NetworkDialog::NetworkDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QStringList netL)
+ : QDialog( parent, name, modal, fl )
+{
+
+ ftp_host = netL[0];
+ networkUrl = strUrl = netL[0];
+
+ dir = ftp_base_dir = netL[1];
+ localFileName = netL[2];
+ s_partialFileName = netL[3];
+
+ resize(240,110);
+
+ local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
+// autoOk = autoDownload;
+// if( networkUrl.find("ftp",0,false)== -1 ) {
+// if ( !name )
+// setName( "HTTP NetworkDialog" );
+// setCaption( tr( "HTTP Download ) );
+// qInitNetworkProtocols(); // registers ftp protocol // for now
+// QNetworkProtocol::registerNetworkProtocol( "http", new QNetworkProtocolFactory<Http> );
+// } else {
+ if ( !name )
+ setName( "FTP NetworkDialog" );
+ setCaption(tr("FTP Download"));
+// }
+ initDialog(); //opens file to be written
+}
+
+NetworkDialog::~NetworkDialog() {
+}
+
+void NetworkDialog::initDialog() {
+
+ totalBytesDownloaded=0;
+ warnLabel = new QLabel( this, "TextLabel" );
+ warnLabel ->setText( tr( "Push Ok to download file...." ) );
+ TextLabel3 = new QLabel( this, "TextLabel3" );
+ TextLabel3->setText( "");
+ QWidget* Layout1 = new QWidget( this, "Layout1" );
+
+ hbox = new QHBoxLayout(Layout1);
+ hbox->setMargin(4);
+
+ ProgressBar1 = new QProgressBar( Layout1, "ProgressBar1" );
+ ProgressBar1->setProgress(0);
+ hbox->addWidget(ProgressBar1,10,AlignCenter);
+
+ hbox->addStretch(1);
+ buttonOk = new QPushButton( Layout1, "buttonOk" );
+ buttonOk->setText( tr( "&OK" ) );
+ hbox->addWidget(buttonOk,0,AlignRight);
+ hbox->addSpacing(5);
+ buttonCancel = new QPushButton( Layout1, "buttonCancel" );
+ buttonCancel->setText( tr( "&Cancel" ) );
+ buttonCancel->setAutoDefault( TRUE );
+ buttonCancel->setDefault( TRUE );
+ hbox->addWidget(buttonCancel,0,AlignRight);
+
+ ProgressBar1->setFixedSize(140,22);
+ buttonOk->setFixedSize(35,22);
+ buttonCancel->setFixedSize(35,22);
+ warnLabel ->setGeometry( QRect( 5,1,230,25));
+ TextLabel3->setGeometry( QRect( 5,20,230,25));
+ Layout1->setGeometry( QRect(1,60,235,50)); //TODO check these!!
+
+// timer= new QTimer(this,"vu timer");
+// connectionTimer=new QTimer(this,"connectionTimeout");
+
+ connect(buttonOk,SIGNAL(clicked()),this,SLOT(doOk()));
+ connect(buttonCancel,SIGNAL(clicked()),this,SLOT(reject()));
+// connect( timer, SIGNAL(timeout()), this , SLOT(timeSlot()));
+// connect( connectionTimer,SIGNAL( timeout()),this,SLOT( connectionTimeSlot()));
+ if(autoOk) {
+ qWarning("XXXXXXXXXXXXXXXXXXXXXXXX");
+ buttonOk->setDown(true);
+ doOk();
+ }
+}
+
+void NetworkDialog::timeSlot() {
+
+// if(timerProgess < 19 && posTimer) {
+// ProgressBar1->setProgress(timerProgess);
+// timerProgess++;
+// } else if(timerProgess > 19 && posTimer) {
+// ProgressBar1->setProgress(timerProgess);
+// timerProgess++;
+// posTimer=FALSE;
+// }
+// if(timerProgess > 1 &&!posTimer) {
+// ProgressBar1->setProgress(timerProgess);
+// timerProgess--;
+// } else if(timerProgess > 1 &&!posTimer){
+// ProgressBar1->setProgress(timerProgess);
+// timerProgess--;
+// posTimer=TRUE;
+// }
+// // qDebug("timer event");
+// qApp->processEvents();
+// repaint();
+}
+
+void NetworkDialog::connectionTimeSlot() {
+// qDebug("Connections timed out");
+// ftpQuit();
+// qApp->processEvents();
+// repaint();
+// reject();
+}
+
+
+/*
+downloads the file networkUrl */
+bool NetworkDialog::downloadFile( QString networkUrl )
+{
+ int fsz;
+// timer->start( 250 , FALSE);
+// posTimer=TRUE;
+// connectionTimer->start( 600 , FALSE);
+ warnLabel ->setText( "");
+ qApp->processEvents();
+ qDebug("Downloading: %s",networkUrl.latin1());
+ qDebug("Into: %s",localFileName.latin1());
+ if( networkUrl.length() > 5) {
+ QString ftp_user = "anonymous";
+ QString ftp_pass = "zaurus@gutenbrowser.com";
+// ftp_host= networkUrl.mid(networkUrl.find("ftp://",0, TRUE),
+ if(ftp_host.length() < 2) {
+ qDebug("Please select an ftp host" );
+ successDownload=false;
+ QMessageBox::message("Note","You need to select an ftp host");
+ return false;
+ }
+ QString msg;
+ qDebug(ftp_host);
+ qDebug("Opening ftp connection.");
+ warnLabel->setText("connecting to: "+ftp_host );
+ qApp->processEvents();
+ /////////// Open FTP connection
+ if (!FtpConnect( ftp_host.latin1(), &conn)) {
+ i=0;
+ successDownload=false;
+ QMessageBox::message("Note","Unable to connect to\n"+ftp_host);
+ return false;
+ }
+ TextLabel3->setText("Opening ftp connection.");
+ qApp->processEvents();
+ if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) {
+ FtpQuit(conn);
+ successDownload=false;
+ msg.sprintf("Unable to log in\n%s",FtpLastResponse(conn));
+ QMessageBox::message("Note",msg);
+ return false;
+ }
+ qDebug("Changing directories.");
+ TextLabel3->setText("Changing directories.");
+ qApp->processEvents();
+ if (!FtpChdir( dir.latin1(), conn )) {
+ successDownload=false;
+ msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn));
+ QMessageBox::message("Note",msg);
+ FtpQuit(conn);
+ return false;
+ }
+// if (!FtpNlst( "./.guten_temp", dir, conn)) {
+// successDownload=false;
+// msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn));
+// QMessageBox::message("Note",msg);
+// FtpQuit(conn);
+// return false;
+// }
+ qDebug("Requesting directory list.");
+ TextLabel3->setText("Getting directory list.");
+ qApp->processEvents();
+ if (!FtpDir( "./.guten_temp", dir.latin1(), conn) ) {
+ msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn));
+ QMessageBox::message("Note",msg);
+ successDownload=false;
+ FtpQuit(conn);
+ return false;
+ }
+ QFile tmp("./.guten_temp");
+ QString s, File_Name;
+
+ if (tmp.open(IO_ReadOnly)) {
+ QTextStream t( &tmp ); // use a text stream
+ qDebug("Finding partial filename "+s_partialFileName);
+ while ( !t.eof()) {
+ s = t.readLine();
+
+ if (s.contains(s_partialFileName, FALSE)) {
+ QString str = s.right( (s.length()) - (s.find(s_partialFileName, FALSE)) );
+
+ if (str.contains(".txt")) {
+ File_Name = str;
+ qDebug("Found file_name "+ File_Name);
+ break;
+ }
+// if (str.contains(".zip")) {
+// File_Name = str;
+// qDebug("Found file_name "+ File_Name);
+// break;
+// }
+
+ }
+ } //end of while loop
+ tmp.close();
+// tmp.remove(); ///TODO this is for release version Zaurus
+ }
+ else
+ qDebug("Error opening temp file.");
+
+ Config cfg("Gutenbrowser");
+ cfg.setGroup("General");
+ QString temp=cfg.readEntry("DownloadDirectory",local_library);
+
+ localFileName = temp+File_Name;
+ qDebug("Requesting file "+ File_Name);
+ qDebug( "Saving as "+localFileName);
+ msg="Requesting file "+ File_Name;
+ TextLabel3->setText(msg);
+ qApp->processEvents();
+ if( File_Name.length()>3) {
+ if (!FtpSize( File_Name.latin1(), &fsz, FTPLIB_ASCII, conn))
+ fsz = 0;
+ QString temp;
+ temp.sprintf( File_Name+" "+" %dkb", fsz);
+ TextLabel3->setText(temp);
+
+ ProgressBar1->setTotalSteps(fsz);
+ FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
+ FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
+ FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
+ FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
+
+ if (!FtpGet( localFileName.latin1(), File_Name.latin1(), FTPLIB_ASCII, conn)) {
+ msg.sprintf("Could not download "+ File_Name+"\n%s",FtpLastResponse(conn));
+ successDownload=false;
+ QMessageBox::message("Note",msg);
+ update();
+ }
+ } else {
+ QMessageBox::message("Note","Could not download file "+ File_Name);
+ successDownload=false;
+ FtpQuit(conn);
+ return false;
+ }
+ qDebug("Ftp session successful");
+ successDownload=TRUE;
+ FtpQuit(conn);
+ return true;
+ } //no network url
+ return false;
+}
+
+void NetworkDialog::doOk() {
+ qWarning("Do OK");
+ QString loginStr;
+ loginStr = "gutenbrowser";
+ if ( !ftp_host.isEmpty() ) {
+ if( ftp_host.find( "/", ftp_host.length() - 1,TRUE) != -1 && ftp_host.find("ftp://",0, TRUE) != -1) {
+ TextLabel3->setText( tr( "List remote dir:\n" + ftp_host) );
+// TextLabel2->setText( tr( "local file to download into: " +localFileName ) );
+
+ if( downloadFile(ftp_host))
+ successDownload = true;
+ else {
+ successDownload = false;
+ reject();
+ }
+ } else {
+ if(downloadFile(ftp_host))
+ successDownload = true;
+ else {
+ successDownload = false;
+ reject();
+ }
+ }
+ }
+ accept();
+}
diff --git a/noncore/apps/opie-gutenbrowser/NetworkDialog.h b/noncore/apps/opie-gutenbrowser/NetworkDialog.h
new file mode 100644
index 0000000..447979f
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/NetworkDialog.h
@@ -0,0 +1,84 @@
+/***************************************************************************
+ NetworkDialog.h - description
+ -------------------
+ begin : Sun Aug 27 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+***************************************************************************/
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+#ifndef NETWORKDIALOG_H
+#define NETWORKDIALOG_H
+
+#include <qdialog.h>
+#include <qurloperator.h>
+#include <qcstring.h>
+#include <qfile.h>
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qstringlist.h>
+
+//#include <qtimer.h>
+
+//class QProgressBar;
+
+class NetworkDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ NetworkDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, const QStringList netList=0);
+/* NetworkDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, const QString & UrlStr = 0, const QString & dirStr=0,const QString & fileStr=0, const QString & psrtialFile=0); */
+ ~NetworkDialog();
+
+ QFile fiole;
+ QTimer * connectionTimer;
+ QTimer * timer;
+ int timerProgess;
+ bool posTimer;
+ QString s_partialFileName, s_finally;
+ bool foundIt, successDownload;
+ QLabel * warnLabel;
+ QLabel* TextLabel3;
+ QPushButton* buttonHelp;
+ bool ok;
+ QString local_library;
+ QString ftp_host;
+ QString ftp_base_dir;
+ QString dir, strUrl, networkUrl;
+
+ QPushButton* buttonOk;
+ QPushButton* buttonCancel;
+
+ QString localFileName;
+ bool fileFound;
+ int i, totalBytesDownloaded;
+ bool autoOk;
+
+ void initDialog();
+
+protected:
+ QHBoxLayout* hbox;
+
+private slots:
+ bool downloadFile( QString strUrl);
+ void connectionTimeSlot();
+ void timeSlot();
+ void doOk();
+
+ private:
+/* #ifndef Q_WS_QWS */
+
+/* QString getOpenFileName(); */
+/* QUrlOperator op; */
+/* #endif */
+};
+
+#endif // NETWORKDIALOG_H
diff --git a/noncore/apps/opie-gutenbrowser/SearchDialog.cpp b/noncore/apps/opie-gutenbrowser/SearchDialog.cpp
new file mode 100644
index 0000000..dab4789
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/SearchDialog.cpp
@@ -0,0 +1,135 @@
+/****************************************************************************
+** Created: Tue Aug 29 11:45:00 2000**/
+// copyright : (C) 2000 -2004 by llornkcor
+// email : ljp@llornkcor.com
+
+#include "SearchDialog.h"
+#include "SearchResults.h"
+
+#include <qlayout.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qvariant.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qmessagebox.h>
+#include <qdir.h>
+#include <qpe/config.h>
+
+/*This is just a single text entry dialog */
+SearchDialog::SearchDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
+ : QDialog( parent, name, modal, fl )
+{
+ if ( !name )
+ setName( "SearchDialog" );
+ Config cfg("Gutenbrowser");
+ cfg.setGroup("General");
+ QString lastSearch=cfg.readEntry("LastSearch","");
+
+#warning FIXME
+ // FIXME
+ resize( 220,100);
+
+ QGridLayout *layout = new QGridLayout( this );
+ layout->setSpacing( 2);
+ layout->setMargin( 2);
+
+ QString local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
+ TextLabel1 = new QLabel( this, "TextLabel1" );
+ layout->addMultiCellWidget( TextLabel1, 0, 0, 0, 1);
+
+ label1Str= "<P>Enter text to search etext for </P>" ;
+ TextLabel1->setText( tr( label1Str) );
+
+ SearchLineEdit = new QLineEdit( this, "SearchLineEdit" );
+ layout->addMultiCellWidget( SearchLineEdit, 1, 1, 0, 1);
+
+ buttonOk = new QPushButton( this, "buttonOk" );
+ buttonOk->setText( tr( "Sea&rch" ) );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setToggleButton( TRUE);
+ buttonOk->setDefault( TRUE );
+
+ layout->addMultiCellWidget(buttonOk, 2, 2, 0, 0);
+
+ buttonCancel = new QPushButton( this, "buttonCancel" );
+ buttonCancel->setText( tr( "&Cancel" ) );
+ buttonCancel->setAutoDefault( TRUE );
+// buttonCancel->setMaximumWidth(40);
+
+
+ if( (QString)name !="Etext Search" )
+ SearchLineEdit->setText(lastSearch);
+
+ caseSensitiveCheckBox = new QCheckBox ( tr("Case Sensitive"), this );
+ layout->addMultiCellWidget( caseSensitiveCheckBox, 3, 3, 0, 1);
+
+ // signals and slots connections
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( byeBye() ) );
+
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( closed() ) );
+ SearchLineEdit->setFocus();
+}
+
+SearchDialog::~SearchDialog()
+{
+}
+
+QString SearchDialog::get_text() {
+ return SearchLineEdit->text();
+}
+
+bool SearchDialog::get_direction() {
+ return false; //search forward
+}
+
+bool SearchDialog::case_sensitive() {
+ return true;
+}
+
+bool SearchDialog::forward_search() {
+ return true;
+}
+
+void SearchDialog::byeBye()
+{
+
+ searchString = get_text();
+// qDebug("Search string is "+searchString);
+ Config cfg("Gutenbrowser");
+ cfg.setGroup("General");
+ cfg.writeEntry("LastSearch",searchString);
+
+ QString thisName=name();
+ if( thisName.find("Library Search", 0, TRUE) != -1) {
+ // searchString = SearchLineEdit->text();
+ accept();
+ } else {
+
+ buttonOk->setDown(TRUE);
+
+ emit search_signal();
+ buttonOk->setDown(FALSE);
+ }
+}
+
+void SearchDialog::closed()
+{
+ searchString = get_text();
+// qDebug("Search string is "+searchString);
+ Config cfg("Gutenbrowser");
+ cfg.setGroup("General");
+ cfg.writeEntry("LastSearch",searchString);
+
+ emit search_done_signal();
+ //this->reject();
+ this->hide();
+}
+
+
+void SearchDialog::setLabel(QString labelText)
+{
+ TextLabel1->setText( tr( label1Str+labelText) );
+}
diff --git a/noncore/apps/opie-gutenbrowser/SearchDialog.h b/noncore/apps/opie-gutenbrowser/SearchDialog.h
new file mode 100644
index 0000000..a7effdd
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/SearchDialog.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+** Form interface generated from reading ui file 'SearchDialog.ui'
+**
+** Created: Tue Aug 29 11:12:09 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+****************************************************************************/
+#ifndef SEARCHDIALOG_H
+#define SEARCHDIALOG_H
+
+#include <qdialog.h>
+#include "SearchResults.h"
+#include <qpe/config.h>
+
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QCheckBox;
+
+class SearchDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SearchDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~SearchDialog();
+
+ QLabel* TextLabel1;
+ QPushButton* buttonOk;
+ QPushButton* buttonCancel;
+ QLineEdit* SearchLineEdit;
+ QString searchString;
+ QString label1Str;
+ QCheckBox *caseSensitiveCheckBox;
+Config *cfg;
+protected:
+ QHBoxLayout* hbox;
+
+public slots: // Public slots
+ void setLabel( QString labelText);
+ void byeBye();
+ bool get_direction();
+ bool case_sensitive();
+ bool forward_search();
+ //void setLabel();
+ void closed();
+ QString get_text();
+signals:
+
+ void search_signal();
+ void search_done_signal();
+};
+
+#endif // SEARCHDIALOG_H
diff --git a/noncore/apps/opie-gutenbrowser/SearchResults.cpp b/noncore/apps/opie-gutenbrowser/SearchResults.cpp
new file mode 100644
index 0000000..c98c53f
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/SearchResults.cpp
@@ -0,0 +1,101 @@
+/****************************************************************************
+** Created: Sat Feb 24 23:35:01 2001
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+****************************************************************************/
+#include "SearchResults.h"
+#include "gutenbrowser.h"
+#include "LibraryDialog.h"
+
+#include <qpe/qpeapplication.h>
+#include <stdio.h>
+#include <qstrlist.h>
+#include <qclipboard.h>
+
+#include <qlayout.h>
+#include <qlistbox.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qvariant.h>
+//#include <qtooltip.h>
+//#include <qwhatsthis.h>
+
+SearchResultsDlg::SearchResultsDlg( QWidget* parent, const char* name, bool modal, WFlags fl, QStringList stringList )
+ : QDialog( parent, name, modal, fl )
+{
+ if ( !name )
+ setName( "SearchResultsDlg" );
+
+ QGridLayout *layout = new QGridLayout( this );
+ layout->setSpacing( 2);
+ layout->setMargin( 2);
+
+ ListBox1 = new QListBox( this, "ListBox1" );
+ outPutLabel=new QLabel( this, "outPutLabel" );
+ statusLabel=new QLabel( this, "StatusLabel" );
+ QString local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
+
+ buttonOk = new QPushButton(this,"buttonOk");
+ buttonCancel = new QPushButton(this,"buttonCancel");
+
+ layout->addMultiCellWidget( buttonOk, 0, 0, 0, 0);
+ layout->addMultiCellWidget( buttonCancel, 0, 0, 1, 1);
+
+ layout->addMultiCellWidget( ListBox1, 1, 4, 0, 1);
+
+ outPutLabel->setMaximumHeight(30);
+ statusLabel->setMaximumHeight(30);
+
+ layout->addMultiCellWidget( outPutLabel, 5, 5, 0, 1);
+ layout->addMultiCellWidget( statusLabel, 6, 6, 0, 1);
+
+
+ setCaption( tr( "Search Results" ) );
+ buttonOk->setText( tr( "&Download" ) );
+ buttonOk->setAutoDefault( TRUE );
+ buttonCancel->setText( tr( "&Cancel" ) );
+ buttonCancel->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ ListBox1->setSelectionMode( QListBox::Single );
+ ListBox1->setMultiSelection(true);
+ statusLabel->setText( "Double click a title to begin downloading." );
+
+ // signals and slots connections
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( dwnLd() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect( ListBox1, SIGNAL( doubleClicked(QListBoxItem *)), SLOT( slotListClicked(QListBoxItem * )) );
+
+ ListBox1->insertStringList( stringList);
+ numListItems= ListBox1->numRows();
+ QString strOut;
+
+ outPutLabel->setText( "Number of results: "+ strOut.sprintf("%d", numListItems) );
+
+// printf( "Sucessfully entered SearchResults Dialog\n");
+// selText = resultStr;
+}
+
+SearchResultsDlg::~SearchResultsDlg()
+{
+}
+
+void SearchResultsDlg::slotListClicked(QListBoxItem *it) {
+
+ resultsList.append(it->text() );
+// resultsList.append(ListBox1->text( 0));
+// selText = ListBox1->currentText();
+ accept();
+}
+
+void SearchResultsDlg::dwnLd() {
+
+ for(unsigned int ji=0; ji< ListBox1->count() ; ji++ ) {
+ if( ListBox1->isSelected( ji) )
+ resultsList.append(ListBox1->text( ji));
+ }
+ accept();
+}
+
+void SearchResultsDlg::downloadButtonSlot() {
+
+}
diff --git a/noncore/apps/opie-gutenbrowser/SearchResults.h b/noncore/apps/opie-gutenbrowser/SearchResults.h
new file mode 100644
index 0000000..bab8e48
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/SearchResults.h
@@ -0,0 +1,51 @@
+
+/****************************************************************************
+** Created: Sat Feb 24 23:32:10 2001
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+
+****************************************************************************/
+#ifndef SEARCHRESULTSDLG_H
+#define SEARCHRESULTSDLG_H
+
+//#include "gutenbrowser.h"
+#include <qdialog.h>
+#include <qlabel.h>
+#include <qstringlist.h>
+#include <qlistbox.h>
+
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+//class QListBox;
+class QListBoxItem;
+class QPushButton;
+
+class SearchResultsDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SearchResultsDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, QStringList stringList=0);
+ ~SearchResultsDlg();
+
+ QLabel* statusLabel, *outPutLabel;
+ QPushButton* buttonOk;
+ QPushButton* buttonCancel;
+ QListBox* ListBox1;
+ QString selText;
+ QStringList resultsList;
+ int numListItems;
+
+protected:
+ QHBoxLayout* hbox;
+public slots:
+ void slotListClicked(QListBoxItem *);
+
+protected slots:
+ void dwnLd();
+ void downloadButtonSlot();
+
+};
+
+#endif // SEARCHRESULTSDLG_H
diff --git a/noncore/apps/opie-gutenbrowser/bookmarksdlg.cpp b/noncore/apps/opie-gutenbrowser/bookmarksdlg.cpp
new file mode 100644
index 0000000..ba042c6
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/bookmarksdlg.cpp
@@ -0,0 +1,34 @@
+/***************************************************************************
+ bookmarksdlg.cpp - description
+ -------------------
+ begin : Wed Dec 1 1999
+ copyright : (C) 1999 -2004 by llornkcor
+ email : ljp@llornkcor.com
+ ***************************************************************************/
+ /***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+// QMessageBox::message( "Note", listItemNumber );
+#include "bookmarksdlg.h"
+
+
+bookMarksDlg::bookMarksDlg(QWidget *parent,QString name) : QDialog(parent,name,true)
+{
+// initDialog();
+
+}
+
+bookMarksDlg::~bookMarksDlg(){
+}
+
+void bookMarksDlg::doIt()
+{
+
+
+ accept();
+}
diff --git a/noncore/apps/opie-gutenbrowser/bookmarksdlg.h b/noncore/apps/opie-gutenbrowser/bookmarksdlg.h
new file mode 100644
index 0000000..8d99b2b
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/bookmarksdlg.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ bookmarksdlg.h - description
+ -------------------
+ begin : Wed Dec 1 1999
+ copyright : (C) 1999 - 2004 by llornkcor
+ email : ljp@llornkcor.com
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef BOOKMARKSDLG_H
+#define BOOKMARKSDLG_H
+
+#include <qwidget.h>
+#include <qlineedit.h>
+#include <qmultilineedit.h>
+#include <qlabel.h>
+//#include <qlistbox.h>
+#include <qpushbutton.h>
+#include <qcombobox.h>
+#include <qdialog.h>
+
+
+class bookMarksDlg : public QDialog {
+ Q_OBJECT
+public:
+ bookMarksDlg(QWidget *parent, QString name);
+ ~bookMarksDlg();
+
+protected:
+// void initDialog();
+ QLineEdit *QLineEdit_1;
+ QMultiLineEdit *QMultiLineEdit_1;
+ QLabel *QLabel_1;
+ QLabel *QLabel_2;
+ QLabel *QLabel_3;
+ QComboBox *QComboBox_1;
+ QPushButton *QPushButton_Ok;
+ QPushButton *QPushButton_cancel;
+
+
+private:
+
+protected slots:
+ virtual void doIt();
+};
+
+#endif
diff --git a/noncore/apps/opie-gutenbrowser/browserDialog.cpp b/noncore/apps/opie-gutenbrowser/browserDialog.cpp
new file mode 100644
index 0000000..5c48da1
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/browserDialog.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+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"
+
+#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" );
+ printf("Brow is: "+browserName+"\n");
+ config.writeEntry("Preferred", browserName);
+ TextLabel3_3->setText( "Current http browser: "+browserName );
+}
+
+void optionsDialog::BrowseSelected() {
+ QString fileName;
+ Config cfg("Gutenbrowser");
+ cfg. setGroup ( "View" );
+ QString dir = cfg.readEntry("LastOpenDirectory", QPEApplication::documentDir());
+ QMap<QString, QStringList> map;
+ map.insert(tr("All"), QStringList() );
+ QStringList text;
+ text << "text/*";
+ map.insert(tr("Text"), text );
+ text << "*";
+ map.insert(tr("All"), text );
+
+ QString str = OFileDialog::getOpenFileName( 2, dir , QString::null, map);
+ if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) {
+ fileName = str;
+// QStringList fileList=browseForFiles->fileList;
+// qDebug(selFile);
+// QStringList::ConstIterator f;
+// QString fileTemp,filer;
+// for ( f = fileList.begin(); f != fileList.end(); f++ ) {
+
+// fileTemp = *f;
+// fileTemp.right( fileTemp.length()-5);
+// fileName = fileTemp;
+// if( !fileName.isEmpty() ){
+// filer = fileName;
+// } 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.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
new file mode 100644
index 0000000..ec67d6e
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/config.in
@@ -0,0 +1,4 @@
+ config OPIE-GUTENBROWSER
+ boolean "gutenbrowser - Gutenberg Project etext reader and selector"
+ default "n"
+ depends ( LIBQPE || LIBQPE-X11 ) && FTPLIB
diff --git a/noncore/apps/opie-gutenbrowser/editTitle.cpp b/noncore/apps/opie-gutenbrowser/editTitle.cpp
new file mode 100644
index 0000000..100370c
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/editTitle.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+** Created: Thu Jan 24 08:47:37 2002
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+****************************************************************************/
+#include "editTitle.h"
+
+#include <qlineedit.h>
+#include <qpushbutton.h>
+
+Edit_Title::Edit_Title( QWidget* parent, const char* name, bool modal, WFlags fl)
+ : QDialog( parent, name, modal, fl )
+{
+ if ( !name )
+ setName( "Edit_Title" );
+ resize( 240, 110 );
+ setMaximumSize( QSize( 240, 110 ) );
+ setCaption( tr( "Edit Title" ) );
+
+ LineEdit1 = new QLineEdit( this, "LineEdit1" );
+ LineEdit1->setGeometry( QRect( 5, 22, 230, 22 ) );
+ newTitle=name;
+ LineEdit1->setText(newTitle);
+
+ PushButton_Cancel = new QPushButton( this, "PushButton_Cancel" );
+ PushButton_Cancel->setGeometry( QRect( 180, 80, 50, 20 ) );
+ PushButton_Cancel->setText( tr( "Cancel" ) );
+
+ PushButton_Apply = new QPushButton( this, "PushButton_Apply" );
+ PushButton_Apply->setGeometry( QRect( 120, 80, 50, 20 ) );
+
+ PushButton_Apply->setText( tr( "Apply" ) );
+
+ // signals and slots connections
+ connect( PushButton_Cancel, SIGNAL( released() ),this, SLOT( onCancel() ) );
+ connect( PushButton_Apply, SIGNAL( released() ), this, SLOT( onApply() ) );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+Edit_Title::~Edit_Title()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+void Edit_Title::onCancel() {
+ reject();
+}
+
+void Edit_Title::onApply() {
+ newTitle= LineEdit1->text();
+ accept();
+}
diff --git a/noncore/apps/opie-gutenbrowser/editTitle.h b/noncore/apps/opie-gutenbrowser/editTitle.h
new file mode 100644
index 0000000..2480a01
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/editTitle.h
@@ -0,0 +1,34 @@
+/****************************************************************************
+** Created: Thu Jan 24 08:47:13 2002
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+****************************************************************************/
+#ifndef EDIT_TITLE_H
+#define EDIT_TITLE_H
+
+#include <qvariant.h>
+#include <qdialog.h>
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QLineEdit;
+class QPushButton;
+
+class Edit_Title : public QDialog
+{
+ Q_OBJECT
+
+public:
+ Edit_Title( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
+ ~Edit_Title();
+
+ QLineEdit* LineEdit1;
+ QPushButton* PushButton_Cancel;
+ QPushButton* PushButton_Apply;
+ QString newTitle;
+public slots:
+ void onCancel();
+ void onApply();
+};
+
+#endif // EDIT_TITLE_H
diff --git a/noncore/apps/opie-gutenbrowser/editTitle.ui b/noncore/apps/opie-gutenbrowser/editTitle.ui
new file mode 100644
index 0000000..8c4de4d
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/editTitle.ui
@@ -0,0 +1,100 @@
+<!DOCTYPE UI><UI>
+<class>Edit_Title</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Edit_Title</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>21</x>
+ <y>8</y>
+ <width>240</width>
+ <height>110</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>maximumSize</name>
+ <size>
+ <width>240</width>
+ <height>110</height>
+ </size>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Edit Title</string>
+ </property>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>LineEdit1</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>22</y>
+ <width>230</width>
+ <height>22</height>
+ </rect>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>PushButton_Cancel</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>120</x>
+ <y>80</y>
+ <width>50</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Cancel</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>PushButton_Apply</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>180</x>
+ <y>80</y>
+ <width>50</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Apply</string>
+ </property>
+ </widget>
+</widget>
+<connections>
+ <connection>
+ <sender>PushButton_Cancel</sender>
+ <signal>released()</signal>
+ <receiver>PushButton_Cancel</receiver>
+ <slot>onCancel()</slot>
+ </connection>
+ <connection>
+ <sender>PushButton_Apply</sender>
+ <signal>released()</signal>
+ <receiver>PushButton_Apply</receiver>
+ <slot>onApply()</slot>
+ </connection>
+</connections>
+</UI>
diff --git a/noncore/apps/opie-gutenbrowser/fontDialog.cpp b/noncore/apps/opie-gutenbrowser/fontDialog.cpp
new file mode 100644
index 0000000..a17b1d3
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/fontDialog.cpp
@@ -0,0 +1,260 @@
+/****************************************************************************
+** Created: Sun Jan 27 11:03:24 2002
+copyright 2002 by L.J. Potter ljp@llornkcor.com
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+****************************************************************************/
+#include "fontDialog.h"
+#include "optionsDialog.h"
+
+#include <qpe/fontdatabase.h>
+#include <qpe/config.h>
+
+#include <qstringlist.h>
+#include <qfontinfo.h>
+#include <qvaluelist.h>
+#include <qpe/qpeapplication.h>
+
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlistbox.h>
+#include <qmultilineedit.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qvariant.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qcombobox.h>
+
+//#define BUGGY_SHARP_ZAURUS 0
+
+static const int nfontsizes = 9;
+static const int fontsize[nfontsizes] = {8,9,10,11,12,13,14,18,24};
+
+
+FontDialog::FontDialog( QWidget * parent, const char* name /*, bool modal, WFlags fl */)
+ :/* QDialog*/ QWidget( parent, name /*, modal, fl */)
+{
+ if ( !name )
+ setName( "FontDialog" );
+ setCaption( tr( "Font Dialog" ) );
+
+ QGridLayout *layout = new QGridLayout( this );
+ layout->setSpacing(2);
+ layout->setMargin(2);
+
+ familyListBox = new QListBox( this, "familyListBox" );
+ layout->addMultiCellWidget( familyListBox, 0, 2, 0, 0);
+
+ QBoxLayout * hbox = new QHBoxLayout(this);
+ QBoxLayout * vbox = new QVBoxLayout(this);
+
+ styleListBox = new QListBox( this, "styleListBox" );
+ vbox->addWidget( styleListBox, 0);
+
+ FontTextLabel4 = new QLabel( this, "TextLabel4" );
+ FontTextLabel4->setText( tr( "Size" ) );
+ hbox->addWidget( FontTextLabel4,0);
+
+ sizeComboBox = new QComboBox( FALSE, this, "SizeCombo");
+// sizeComboBox->setMaximumWidth(60);
+ hbox->addWidget( sizeComboBox, 0);
+
+ vbox->addLayout(hbox,0);
+ layout->addLayout( vbox,0,3);
+
+ MultiLineEdit1 = new QMultiLineEdit( this, "MultiLineEdit1" );
+ MultiLineEdit1->setText( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" ) );
+ MultiLineEdit1->setWordWrap( QMultiLineEdit::WidgetWidth);
+
+ layout->addMultiCellWidget( MultiLineEdit1, 4, 4, 0, 3);
+
+ connect(familyListBox,SIGNAL(highlighted(const QString &)),SLOT(familyListBoxSlot(const QString &)));
+ connect(styleListBox,SIGNAL(highlighted(const QString &)),SLOT(styleListBoxSlot(const QString &)));
+ connect(sizeComboBox,SIGNAL(activated(const QString &)),SLOT(sizeComboBoxSlot(const QString &)));
+
+ populateLists();
+
+}
+
+FontDialog::~FontDialog()
+{
+}
+
+void FontDialog::familyListBoxSlot(const QString & text)
+{
+ int styleInt = styleListBox->currentItem();
+ int sizeInt = sizeComboBox->currentText().toInt();
+
+ sizeComboBox->clear();
+ styleListBox->clear();
+// clearListBoxes();
+ family = text;
+// qDebug(family);
+ QStringList styles = fdb.styles( family ); // string list of styles of our current font family
+ styleListBox->insertStringList( styles);
+ QString dstyle;// = "\t" + style + " (";
+
+#ifdef BUGGY_SHARP_ZAURUS
+
+QValueList<int> smoothies = fdb.smoothSizes( family, styleListBox->text(0) );
+ for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) {
+ dstyle = QString::number( *points );
+ qDebug(dstyle);
+ sizeComboBox->insertItem( dstyle.left( dstyle.length() - 1 ));
+ }
+#else
+
+ for (int i=0; i<nfontsizes; i++) {
+ sizeComboBox->insertItem( QString::number(fontsize[i]));
+ if(fontsize[i] == sizeInt) {
+ sizeComboBox->setCurrentItem(i);
+ }
+ }
+#endif
+
+ if(styleInt == -1 || styleInt > styleListBox->count() )
+ styleListBox->setCurrentItem(0);
+ else
+ styleListBox->setCurrentItem(styleInt);
+
+ changeText();
+}
+
+void FontDialog::styleListBoxSlot(const QString &text)
+{
+ changeText();
+}
+
+void FontDialog::sizeComboBoxSlot(const QString & text)
+{
+ changeText();
+}
+
+void FontDialog::populateLists()
+{
+// QFont defaultFont=MultiLineEdit1->font();
+// QFont defaultFont=Lview->font();
+// QFontInfo fontInfo(defaultFont);
+ Config config("Gutenbrowser");
+ config.setGroup("Font");
+ QString familyStr = config.readEntry("Family", "fixed");
+ QString styleStr = config.readEntry("Style", "Regular");
+ QString sizeStr = config.readEntry("Size", "10");
+ QString charSetStr = config.readEntry("CharSet", "iso10646-1" );
+ bool ok;
+ int i_size = sizeStr.toInt(&ok,10);
+ selectedFont = fdb.font(familyStr,styleStr,i_size,charSetStr);
+// defaultFont.setItalic(TRUE);
+ families = fdb.families();
+
+ for ( QStringList::Iterator f = families.begin(); f != families.end();++f ) {
+ QString family = *f;
+// if(family == defaultFont.family())
+// qDebug(family);
+ familyListBox->insertItem( family);
+
+ if( familyListBox->text(0) == family) {
+ QStringList styles = fdb.styles( family );
+// string list of styles of our current font family
+ styleListBox->insertStringList( styles);
+
+ for ( QStringList::Iterator s = styles.begin(); s != styles.end();++s ) { // for each font style
+ style = *s;
+ QString dstyle;// = "\t" + style + " (";
+ if(styleListBox->text(0) == style) {
+
+ QValueList<int> smoothies = fdb.smoothSizes( family, style );
+ for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) {
+ dstyle = QString::number( *points ) + " ";
+ sizeComboBox ->insertItem( dstyle.left( dstyle.length() - 1 ));
+ }
+ dstyle = dstyle.left( dstyle.length() - 1 ) + ")";
+ }
+ } // styles
+ }
+ }
+ for(int i=0;i < familyListBox->count();i++) {
+ if( familyListBox->text(i) == familyStr)
+ familyListBox->setSelected( i, TRUE);
+ }
+
+ for(int i=0;i < styleListBox->count();i++) {
+ if( styleListBox->text(i) == styleStr)
+ styleListBox->setSelected( i, TRUE);
+ }
+
+ for (int i=0; i<sizeComboBox->count(); i++) {
+
+#ifdef BUGGY_SHARP_ZAURUS
+ if(sizeComboBox->text(i) == sizeStr)
+#else
+ if(fontsize[i] == i_size)
+#endif
+ sizeComboBox->setCurrentItem(i);
+ }
+ changeText();
+}
+
+void FontDialog::clearListBoxes() {
+ familyListBox->clear();
+ sizeComboBox->clear();
+ styleListBox->clear();
+}
+
+void FontDialog::changeText()
+{
+ if( familyListBox->currentItem() == -1)
+ family= familyListBox->text(0);
+ else {
+ family = familyListBox->currentText();
+ }
+// qDebug("Font family is "+family);
+ if( styleListBox->currentItem() == -1)
+ style=styleListBox->text(0);
+ else {
+ style = styleListBox->currentText();
+ }
+// qDebug("font style is "+style);
+
+ if( sizeComboBox->currentItem() == -1 )
+ size = sizeComboBox->text(0);
+ else {
+ size = sizeComboBox->currentText();
+ }
+
+// qDebug("Font size is "+size);
+ bool ok;
+ int i_size = size.toInt(&ok,10);
+ QStringList charSetList = fdb.charSets(family);
+// QStringList styles = fdb.styles( family ); // string list of styles of our current font family
+ QString charSet;
+ for ( QStringList::Iterator s = charSetList.begin(); s != charSetList.end();++s ) { // for each font style
+ charSet = *s;
+// qDebug(charSet);
+ }
+ selectedFont = fdb.font(family,style,i_size,charSet);
+ QFontInfo fontInfo( selectedFont);
+// if(fontInfo.italic() ) qDebug("italic");
+ selectedFont.setWeight(fontInfo.weight() );
+// qDebug("Style are "+style+" %d ",fontInfo.weight());
+ Config cfg("Gutenbrowser");
+ cfg.setGroup("Font");
+ cfg.writeEntry("Family",family);
+ cfg.writeEntry("Style",style);
+ cfg.writeEntry("Size",size);
+ cfg.writeEntry("CharSet",charSet);
+
+ if(style.find("Italic",0,TRUE) != -1) {
+ selectedFont = fdb.font(family,"Regular",i_size,charSet);
+ selectedFont.setItalic(TRUE); //ya right
+ cfg.writeEntry("Italic","TRUE");
+// qDebug("Style is "+styleListBox->currentText());
+ } else
+ cfg.writeEntry("Italic","FALSE");
+
+ MultiLineEdit1->setFont( selectedFont);
+ MultiLineEdit1->update();
+ changedFonts=TRUE;
+}
+
diff --git a/noncore/apps/opie-gutenbrowser/fontDialog.h b/noncore/apps/opie-gutenbrowser/fontDialog.h
new file mode 100644
index 0000000..08a83ac
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/fontDialog.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+** Created: Sun Jan 27 11:02:59 2002
+copyright 2002 by L.J. Potter ljp@llornkcor.com
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+****************************************************************************/
+#ifndef FONTDIALOG_H
+#define FONTDIALOG_H
+
+#include <qvariant.h>
+#include <qdialog.h>
+#include <qpe/fontdatabase.h>
+#include <qfont.h>
+
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QLabel;
+class QListBox;
+class QListBoxItem;
+class QPushButton;
+class QGroupBox;
+class QMultiLineEdit;
+class QComboBox;
+
+class FontDialog : public /*QDialog*/ QWidget
+{
+ Q_OBJECT
+
+public:
+ FontDialog( QWidget * parent = 0, const char* name = 0 /*, bool modal=FALSE, WFlags fl = 0 */);
+ ~FontDialog();
+
+ QLabel *FontTextLabel4;
+ QGroupBox *FamilyGroup, *GroupBox2;
+ QListBox *familyListBox, *styleListBox, *sizeListBox;
+ QMultiLineEdit *MultiLineEdit1;
+ QPushButton *PushButtonOk,*PushButtonCancel;
+ QStringList families;
+ QComboBox *sizeComboBox;
+
+ FontDatabase fdb;
+ QString family, style, size;
+ QFont selectedFont;
+ bool changedFonts;
+ void populateLists();
+ void clearListBoxes();
+ void changeText();
+protected slots:
+
+ void familyListBoxSlot(const QString &);
+ void styleListBoxSlot(const QString &);
+ void sizeComboBoxSlot(const QString &);
+// void sizeListBoxSlot(const QString &);
+
+
+};
+
+#endif // FONTDIALOG_H
diff --git a/noncore/apps/opie-gutenbrowser/fontDialog.ui b/noncore/apps/opie-gutenbrowser/fontDialog.ui
new file mode 100644
index 0000000..e065c80
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/fontDialog.ui
@@ -0,0 +1,201 @@
+<!DOCTYPE UI><UI>
+<class>FontDialog</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>FontDialog</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>232</width>
+ <height>320</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>maximumSize</name>
+ <size>
+ <width>240</width>
+ <height>320</height>
+ </size>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Font Dialog</string>
+ </property>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>120</x>
+ <y>5</y>
+ <width>110</width>
+ <height>90</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Font Style</string>
+ </property>
+ <widget>
+ <class>QListBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>New Item</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>styleListBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>5</x>
+ <y>20</y>
+ <width>100</width>
+ <height>61</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ </widget>
+ </widget>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>FamilyGroup</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>5</x>
+ <y>5</y>
+ <width>115</width>
+ <height>135</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Font</string>
+ </property>
+ <widget>
+ <class>QListBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>New Item</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>familyListBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>5</x>
+ <y>20</y>
+ <width>100</width>
+ <height>105</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ </widget>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>145</x>
+ <y>100</y>
+ <width>30</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Size</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QListBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>1</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>sizeListBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>180</x>
+ <y>100</y>
+ <width>40</width>
+ <height>60</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget>
+ <class>QMultiLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>MultiLineEdit1</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>5</x>
+ <y>165</y>
+ <width>222</width>
+ <height>45</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>wordWrap</name>
+ <enum>WidgetWidth</enum>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>The Quick Brown Fox Jumps Over The Lazy Dog</string>
+ </property>
+ </widget>
+</widget>
+</UI>
diff --git a/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp b/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp
new file mode 100644
index 0000000..ad770b5
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp
@@ -0,0 +1,247 @@
+/***************************************************************************
+ ftpsitedlg.cpp - description
+ -------------------
+ begin : Tue Jul 25 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+ ***************************************************************************/
+/***************************************************************************
+ * 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 "optionsDialog.h"
+#include "gutenbrowser.h"
+//#include "NetworkDialog.h"
+#include "output.h"
+
+#include <qprogressbar.h>
+#include <stdlib.h>
+#include <qurloperator.h>
+#include <qpe/config.h>
+#include <qlistbox.h>
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+// :)~
+void optionsDialog::ftpSiteDlg( )
+{
+//printf( "ftpSiteDlg: ListFile is "+ ListFile +"\n" );
+// initDialog();
+ local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
+// ListFile = local_library + "ftpList";
+ ListFile = QPEApplication::qpeDir() + "/etc/gutenbrowser";
+ QDir dir(ListFile);
+ if( !dir.exists())
+ dir.mkdir(ListFile,true);
+ ListFile+="/ftpList";
+ qDebug("opening "+ListFile);
+ if ( QFile(ListFile).exists() ) {
+ openSiteList();
+ } else {
+ switch( QMessageBox::warning( this, "Gutenbrowser",
+ "Do you want to download \nan ftp site list?",
+ QMessageBox::Yes, QMessageBox::No)) {
+ case QMessageBox::Yes: // yes
+ getSite();
+ break;
+ case QMessageBox::No: // No
+ // exit
+ break;
+ }
+
+ }
+}
+
+
+/*
+// get ftp list from web- parse it. */
+void optionsDialog::getSite()
+{
+ QString file_name;
+ QString ftp_listFileURL;
+ QString outputFile;
+// outputFile = local_library+ "list.html";
+ outputFile = ListFile + "list.html";
+ QString networkUrl= "http://www.gutenberg.org/www/mirror.sites.html";
+//http://www.gutenberg.org/index.html";
+// QString networkUrl= "http://llornkcor.com/index.shtml";
+// // "http://www.gutenberg.org/index.html"
+//
+//Qhttp stops working at times.... :(
+// NetworkDialog *NetworkDlg;
+// NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog",TRUE,0,networkUrl,outputFile);
+// if( NetworkDlg->exec() != 0 )
+// { // use new, improved, *INSTANT* network-dialog-file-getterer
+// qDebug("gitcha!");
+// }
+// delete NetworkDlg;
+//#ifdef Q_WS_QWS
+
+// TODO qprocess here
+
+ QString cmd="wget -T 15 -O " +outputFile + " " + networkUrl + " 2>&1" ;
+ qDebug("Issuing the command "+cmd);
+ Output *outDlg;
+ outDlg = new Output( 0, tr("Downloading ftp sites...."),TRUE);
+ outDlg->showMaximized();
+ outDlg->show();
+ qApp->processEvents();
+ FILE *fp;
+ char line[130];
+ outDlg->OutputEdit->append( tr("Running wget") );
+ sleep(1);
+ fp = popen( (const char *) cmd, "r");
+ while ( fgets( line, sizeof line, fp)) {
+ outDlg->OutputEdit->append(line);
+ outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
+ }
+ pclose(fp);
+ outDlg->close();
+ if(outDlg)
+ delete outDlg;
+
+// outputFile=ListFile;
+ ftp_QListBox_1->clear();
+ parseFtpList( outputFile); // got the html list, now parse it so we can use it
+}
+
+bool optionsDialog::parseFtpList( QString outputFile)
+{
+// parse ftplist html and extract just the machine names/directories
+// TODO: add locations!!
+ qDebug("parse ftplist "+outputFile);
+ QString ftpList, s_location;
+ QFile f( outputFile );
+
+ if( f.open( IO_ReadWrite )) {
+ QTextStream t( &f);
+ QString countryName;
+ bool b_gotchTest=false;
+
+ while ( !t.eof() ) {
+ QString s = t.readLine();
+ int start;
+ int end;
+ if( s.find( "FTP mirror sites for Project Gutenberg:", 0, TRUE) !=-1) { //lower end of this file
+ b_gotchTest = true;
+ }
+ if( b_gotchTest) {
+ if(( start = s.find( "ftp://", 0, TRUE))!=-1 ) {
+ end = s.find( "/\"", 0, TRUE);// ==-1)) {
+ if( end == -1) {
+ end = s.find( "\">");
+ }
+ ftpSite = s.mid( start, (end - start) );
+ if(ftpSite.right(1) != "/") {
+ // ftpSite += "/";
+ }
+ ftpSite=ftpSite.right( ftpSite.length()-6);
+ if( ftpSite.find("\n", 0, TRUE) )
+ ftpSite.remove( ftpSite.find("\n", 0, TRUE), 1);
+
+ if( ftpSite.find("\"", 0, TRUE) )
+ ftpSite.remove( ftpSite.find("\"", 0, TRUE), 1);
+ if( ftpSite.find("a>", 0, TRUE) )
+ ftpSite.remove( ftpSite.find("a>", 0, TRUE) -2, 4);
+
+
+ s = t.readLine();
+ s = t.readLine();
+ if(( start=s.find("<BR>(", 0, TRUE) ) != -1) {
+// qDebug("%s",s.latin1());
+ end = s.find( ")", 0, TRUE)+1;
+ s_location= s.mid( start+4, (end - start) );
+
+// qDebug("%s", s_location.latin1());
+// ftpList += ftpSite + "\n";
+// ftp_QListBox_1->sort( TRUE );
+ ftpList += s_location+ " "+ftpSite+"\n";
+
+ ftp_QListBox_1->sort( TRUE );
+ QString winbug=" ";
+ ftp_QListBox_1->insertItem ( s_location.latin1() +winbug+ftpSite);
+ // ftp_QListBox_1->insertItem ( ftpSite+" "+s_location.latin1());
+ }
+
+ // ftp_QListBox_1->insertItem ( ftpSite);
+ }
+ } // end find ftp://
+
+ } // end while loop
+ QFile f2( ListFile);
+ if(!f2.open( IO_ReadWrite | IO_Truncate))
+ QMessageBox::message( (tr("Note")), (tr("File not opened sucessfully.\n"+ListFile )) );
+ f2.writeBlock( ftpList, ftpList.length() );
+ f.close();
+ f2.close();
+ if( f.exists() )
+ f.remove();
+ } else {
+ QMessageBox::message( (tr("ftpSiteDlg")), (tr("List File not opened sucessfully." )) );
+ return false;
+ }
+ setActiveWindow();
+ return true;
+}
+
+void optionsDialog::openSiteList() {
+
+ qDebug(" just opens the ftp site list");
+// ListFile = ( QDir::homeDirPath ()) +"/.gutenbrowser/ftpList";
+ QFile f( ListFile);
+ if(!f.open( IO_ReadWrite )) {
+ QMessageBox::message( (tr("Note")), (tr("File not opened sucessfully." )) );
+ } else {
+ QTextStream t( &f);
+ while ( !t.atEnd() ) {
+ QString ftpSite = t.readLine();
+ ftp_QListBox_1->sort( TRUE );
+ ftp_QListBox_1->insertItem ( ftpSite);
+
+ } // end while loop
+ f.close();
+ }
+
+ QListBoxItem *itemSel=0;
+ if( (itemSel=ftp_QListBox_1->findItem( ftp_host)) )
+ ftp_QListBox_1->setSelected( itemSel, true);
+}
+
+/*
+List box clicked */
+void optionsDialog::getSelection( QListBoxItem *item)
+{
+ QString selctionStr;
+ selctionStr = item->text();
+// selctionStr = ftp_QListBox_1->currentText();
+// printf( selctionStr+"\n" );
+ select_site( selctionStr );
+}
+
+void optionsDialog::select_site( const char *index )
+{
+// ftp://ftp.datacanyon.com/pub/gutenberg/
+
+ s_site = index;
+ QString s_site2;
+// if(s_site.find("(",0,TRUE))
+ s_site2=s_site.right( s_site.length()-(s_site.find(" ",0,TRUE)+4) );
+qDebug("Selected ftp site is "+ s_site2);
+ int i_ftp = s_site2.find("/", 0, FALSE);
+ ftp_host = s_site2.left(i_ftp );
+ ftp_base_dir = s_site2.right( s_site2.length() - i_ftp);
+
+// config->read();
+ Config config("Gutenbrowser");
+ config.setGroup( "FTPsite" );
+ config.writeEntry("SiteName",ftp_host);
+ config.writeEntry("base",ftp_base_dir);
+// config->write();
+ TextLabel3->setText( "Current ftp server:\n"+ftp_host /*+ ftp_base_dir*/ );
+// optionsDialog::accept();
+}
+
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
new file mode 100644
index 0000000..2a9a71e
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
@@ -0,0 +1,1984 @@
+/***************************************************************************
+ gutenbrowser.cpp - description
+ -------------------
+ begin : Mon Jul 24 22:33:12 MDT 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+* 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. *
+***************************************************************************/
+// http search
+// http://digital.library.upenn.edu/books/authors.html
+// http://digital.library.upenn.edu/books/titles.html
+// ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL
+// donate@gutenberg.net
+#include <qpe/qpeapplication.h>
+#include <qpe/fontdatabase.h>
+#include <qpe/config.h>
+#include <qpe/qcopenvelope_qws.h>
+#include <qpe/mimetype.h>
+#include <qpe/resource.h>
+#include <qpe/applnk.h>
+
+#include "editTitle.h"
+#include "gutenbrowser.h"
+#include "LibraryDialog.h"
+ //#include "bookmarksdlg.h"
+#include "optionsDialog.h"
+#include "helpme.h"
+#include "NetworkDialog.h"
+
+#include "openetext.h"
+#include "output.h"
+
+
+#include <qregexp.h>
+#include <qregion.h>
+#include <qpaintdevicemetrics.h>
+#include <qvaluelist.h>
+#include <qlabel.h>
+#include <qclipboard.h>
+#include <qpainter.h>
+#include <qpalette.h>
+#include <qobjectlist.h>
+#include <qfontdialog.h>
+#include <qtextview.h>
+#include <qbrush.h>
+#include <qfile.h>
+#include <qfontinfo.h>
+#include <qscrollview.h>
+#include <qpoint.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+
+static const int nfontsizes = 9;
+static const int fontsize[nfontsizes] = {8,9,10,11,12,13,14,18,24};
+
+#ifdef NOQUICKLAUNCH
+Gutenbrowser::Gutenbrowser()
+ Gutenbrowser();
+#else
+Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags )
+#endif
+ : QMainWindow()
+ {
+ // QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
+ // QCopEnvelope e("QPE/System", "grabKeyboard(QString)" );
+ // e << "";
+ // QPEApplication::grabKeyboard();
+ showMainList=TRUE;
+ working=false;
+ this->setUpdatesEnabled(TRUE);
+ // #ifndef Q_WS_QWS
+ QString msg;
+ msg="You have now entered unto gutenbrowser,\n";
+ msg+="make your self at home, sit back, relax and read something great.\n";
+
+ local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
+ setCaption("Gutenbrowser");// Embedded " VERSION);
+ this->setUpdatesEnabled(TRUE);
+
+ // bool firstTime=FALSE;
+ topLayout = new QVBoxLayout( this, 0, 0, "topLayout");
+
+ menu = new QHBoxLayout(-1,"menu");
+ buttons2 = new QHBoxLayout(-1,"buttons2");
+ edits = new QHBoxLayout(-1,"edits");
+
+ useSplitter=TRUE;
+
+ initConfig();
+ initMenuBar();
+ initButtonBar();
+ initStatusBar();
+ initView();
+ initSlots();
+
+ QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold);
+
+ connect( mainList, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint &)),
+ this, SLOT( mainListPressed(int, QListBoxItem *, const QPoint &)) );
+ if( useIcons)
+ toggleButtonIcons( TRUE);
+ else
+ toggleButtonIcons( FALSE);
+
+ enableButtons(false);
+
+ Config config("Gutenbrowser"); // populate menubuttonlist
+ config.setGroup("General");
+
+ config.setGroup( "Files" );
+ QString s_numofFiles = config.readEntry("NumberOfFiles", "0" );
+ int i_numofFiles = s_numofFiles.toInt();
+
+ QString tempFileName;
+
+ for (int i = 0; i <= i_numofFiles; i++) {
+ // tempFileName.setNum(i);
+ config.setGroup( "Files" );
+ QString ramble = config.readEntry( QString::number(i), "" );
+
+ config.setGroup( "Titles" );
+ QString tempTitle = config.readEntry( ramble, "");
+ config.setGroup( tempTitle);
+ int index=config.readNumEntry( "LineNumber", -1 );
+ if( index != -1) {
+ // qDebug( tempTitle);
+ bookmarksMenu->insertItem( tempTitle);
+ }
+ }
+
+ // QString gutenIndex= local_library + "GUTINDEX.ALL";
+ QString gutenIndex= QPEApplication::qpeDir()+ "/etc/gutenbrowser/GUTINDEX.ALL";
+
+ if( QFile( gutenIndex).exists() ) {
+ indexLib.setName( gutenIndex);
+ } else {
+ QString localLibIndexFile = QPEApplication::qpeDir()+ "/etc/gutenbrowser/PGWHOLE.TXT";
+ // QString localLibIndexFile= local_library + "PGWHOLE.TXT";
+ newindexLib.setName( localLibIndexFile);
+ }
+ LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */);
+ loadCheck=false;
+ chdir(local_library);
+ if(!showMainList) {
+ Lview->setFocus();
+ // if(firstTime)
+ // Bookmark();
+ for (int i=1;i< qApp->argc();i++) {
+ qDebug("Suppose we open somethin");
+ load(qApp->argv()[i]);
+ }
+ } else {
+ fillWithTitles();
+ mainList->setFocus();
+ // mainList->setCurrentItem(0);
+
+ }
+ writeConfig();
+} //end init
+
+Gutenbrowser::~Gutenbrowser() {
+ // QPEApplication::grabKeyboard();
+ // QPEApplication::ungrabKeyboard();
+ qDebug("Exit");
+}
+
+ /*
+ Google.com search */
+void Gutenbrowser::InfoBarClick() {
+ QString text;
+ if( Lview->hasSelectedText()) {
+ Lview->copy();
+ QClipboard *cb = QApplication::clipboard();
+ text = cb->text();
+ } else {
+ // text=title;
+ text=this->caption();
+ }
+ searchGoogle(text);
+}
+
+ /*
+ download http with wget or preferred browser */
+void Gutenbrowser::goGetit( const QString &url, bool showMsg) {
+ // int eexit=0;
+ QString cmd;
+ // config.read();
+ qApp->processEvents();
+ QString filename = QPEApplication::qpeDir();
+ if(filename.right(1)!="/")
+ filename+="/etc/gutenbrowser/";
+ else
+ filename+="etc/gutenbrowser/";
+ qDebug("filename "+filename);
+ // QString filename = QDir::homeDirPath()+"/Applications/gutenbrowser/";
+
+ filename += url.right( url.length() - url.findRev("/",-1,TRUE) -1);
+
+ Config config("Gutenbrowser");
+ config.setGroup( "Browser" );
+ QString brow = config.readEntry("Preferred", "Opera");
+ qDebug("Preferred browser is "+brow);
+ if(!showMsg) { //if we just get the gutenindex.all
+ cmd="wget -O " + filename +" " + url+" 2>&1" ;
+ chdir(local_library);
+ qDebug("Issuing the system command: %s", cmd.latin1());
+
+ Output *outDlg;
+ outDlg = new Output(this, tr("Gutenbrowser Output"),FALSE);
+ outDlg->showMaximized();
+ outDlg->show();
+ qApp->processEvents();
+ FILE *fp;
+ char line[130];
+ outDlg->OutputEdit->append( tr("Running wget") );
+ sleep(1);
+ fp = popen( (const char *) cmd, "r");
+ // qDebug("Issuing the command\n"+cmd);
+ // system(cmd);
+ while ( fgets( line, sizeof line, fp)) {
+ outDlg->OutputEdit->append(line);
+ outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
+ }
+ pclose(fp);
+ outDlg->close();
+ if(outDlg)
+ delete outDlg;
+ } else {
+ if( brow == "Konq") {
+ cmd = "konqueror "+url+" &";
+ }
+ if( brow == "Opera") { //for desktop testing
+ cmd = "opera "+url+" &";
+ }
+ // if( brow == "Opera") { // on Zaurus
+ // cmd = "operagui "+url+" &";
+ // }
+ if( brow == "Mozilla") {
+ cmd = "mozilla "+url+" &";
+ }
+ if( brow == "Netscape") {
+ cmd = "netscape "+url+" &";
+ }
+ if(brow == "wget") {
+ // cmd="wget -q "+url+" &";
+ QString tempHtml=local_library+"webster.html";
+ cmd="wget -O "+tempHtml+" -q "+url;
+ }
+
+ chdir(local_library);
+ qDebug("Issuing the sys command: %s", cmd.latin1());
+ system(cmd);
+ }
+}
+
+void Gutenbrowser::toggleButtonIcons( bool useEm) {
+ QString pixDir;
+ if(useEm)
+ useEm=TRUE;
+ pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser";
+ qDebug("Docdir is "+QPEApplication::documentDir());
+
+ if( useIcons && QDir( pixDir).exists() ) {
+ LibraryButton->setPixmap( Resource::loadPixmap("home") ); //in inline
+ OpenButton->setPixmap( Resource::loadPixmap("gutenbrowser/openbook"));
+ ForwardButton->setPixmap( Resource::loadPixmap("forward"));//in inline
+ BackButton->setPixmap( Resource::loadPixmap("back") );//in inline
+ SearchButton->setPixmap( Resource::loadPixmap("gutenbrowser/search") );//in inline
+ lastBmkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark_folder"));
+ setBookmarkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark") );
+ dictionaryButton->setPixmap( Resource::loadPixmap("gutenbrowser/spellcheck") );
+ InfoBar->setPixmap( Resource::loadPixmap("gutenbrowser/google"));
+ }
+}
+
+
+bool Gutenbrowser::queryExit()
+{
+ int exit=QMessageBox::information(this, "Quit...", "Do your really want to quit?",
+ QMessageBox::Ok, QMessageBox::Cancel);
+ if (exit==1) {
+ writeConfig();
+ qApp->quit();
+ } else {
+ };
+ return (exit==1);
+}
+
+ // SLOT IMPLEMENTATION
+
+void Gutenbrowser::slotFilePrint() {
+}
+
+void Gutenbrowser::ByeBye() {
+ if (b_queryExit)
+ queryExit();
+ else {
+ // writeConfig();
+ qApp->quit();
+ }
+}
+
+void Gutenbrowser::HelpBtn() {
+ HelpMe* HelpDlg;
+ HelpDlg = new HelpMe( this, "Help Dialog");
+ HelpDlg->showMaximized();
+}
+
+void Gutenbrowser::DownloadIndex() {
+#ifndef Q_WS_QWS
+ {
+ switch( QMessageBox::information( 0, (tr("Download Library Index, or FTP sites?")),
+ (tr("Do you want to download the newest\n"
+ "Project Gutenberg Library Index?\n"
+ "or select an ftp site?\n")),
+ (tr("&Library Index")), (tr("&Ftp Site")), (tr("&Cancel")), 2, 2 ) )
+ {
+ case 0: // index clicked,
+ downloadLibIndex();
+ break;
+
+ case 1: // ftp selected
+ downloadFtpList();
+ break;
+
+ case 2: // Cancel
+ break;
+ };
+ }
+#endif
+} // end DownloadIndex
+
+
+void Gutenbrowser::downloadFtpList() {
+ // QString cmd="wget http://www.promo.net/pg/list.html");
+ //system(cmd);
+ qApp->processEvents();
+ optionsDialog* optDlg;
+ optDlg = new optionsDialog( this,"Options_Dlg", true);
+ optDlg->getSite();
+ if(optDlg)
+ delete optDlg;
+}
+
+
+void Gutenbrowser::downloadLibIndex() {
+ // QString dwmloader = local_library + "pgwhole.zip";
+ // QString cmd = "lynx -source http://www.gutenberg.net/pgwhole.zip | cat >> " + dwmloader;
+ // system(cmd);
+
+ // QString outputFile= local_library+ "GUTINDEX.ALL";
+ // config.setGroup( "FTPsite" ); // ftp server config
+ // ftp_host=config.readEntry("SiteName", "");
+ // ftp_base_dir= config.readEntry("base", "");
+ // QString networkUrl= "ftp://"+ftp_host+ftp_base_dir+"/GUTINDEX.ALL";
+ QDir dir( local_library);
+ dir.cd("", TRUE);
+ goGetit( "http://sailor.gutenberg.org/GUTINDEX.ALL", false); // until ghttp works on binaries -qt3
+ // goGetit( "http://www.gutenberg.net/pgwhole.zip", true); // until ghttp works on binaries -qt3
+ // NetworkDialog *NetworkDlg;
+ // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkUrl, outputFile );
+ // if( NetworkDlg->exec() != 0 )
+ // { // use new, improved, *INSTANT* network-dialog-file-getterer
+ //// QMessageBox::message("Note","");
+ // }
+ // if(NetworkDlg)
+ // delete NetworkDlg;
+}
+
+
+void Gutenbrowser::PrintBtn() {
+}
+
+void Gutenbrowser::SearchBtn() {
+ if( loadCheck) {
+ qDebug("loadCheck: we have a loaded doc");
+ Search();
+ }
+ // else
+ // QMessageBox::message("Note","Sorry, can't search. No etext is loaded");
+}
+
+
+void Gutenbrowser::ForwardBtn() {
+
+ if( !ForwardButton->autoRepeat() && !ForwardButton->isDown()) {
+
+ QString s;
+ QString insertString;
+ int pageSize= Lview->PageSize();
+ Lview->clear();
+
+ for(int fd=0; fd < pageSize - 1;fd++) {
+ f.readLine(s, 256);
+ if(useWrap)
+ s.replace(QRegExp("\n"),"");
+ insertString+=s;
+ Lview->insertLine( s, -1);
+ // qDebug(s);
+ currentLine++;
+ }
+ // Lview->insertAt( insertString,0,0, FALSE);
+ currentFilePos = f.at();
+ // if( i_pageNum != pages) {
+ // Lview->MultiLine_Ex::pageDown( FALSE);
+ i_pageNum++;
+ pageStopArray.resize(i_pageNum + 1);
+ // int length = Lview->length();
+
+ pageStopArray[i_pageNum ] = currentFilePos;
+ // qDebug("%d current page is number %d, pagesize %d, length %d, current %d",
+ // currentFilePos, i_pageNum, pageSize, Lview->length(), pageStopArray[i_pageNum] );
+ setStatus();
+ Lview->setCursorPosition( 0, 0, FALSE);
+ // }
+
+ } else {
+ // qDebug("bal");
+ // if( i_pageNum != pages) {
+
+ // // int newTop = Lview->Top();
+ // // if(Lview->lastRow() > i)
+ // Lview->ScrollUp(1);
+ // // i_pageNum++;
+ // setStatus();
+ // Lview->setCursorPosition( Lview->Top(), 0, FALSE);
+
+ // }
+
+ }
+ Lview->setFocus();
+
+ // qDebug("page number %d line number %d", i_pageNum, currentLine);
+}
+
+
+void Gutenbrowser::BackBtn() {
+ if( i_pageNum > 0) {
+ int pageSize= Lview->PageSize();
+ // int length=Lview->length();
+
+ i_pageNum--;
+ currentFilePos = f.at();
+
+ // qDebug("%d move back to %d, current page number %d, %d, length %d",
+ // currentFilePos, pageStopArray[i_pageNum - 1 ], i_pageNum, pageSize, Lview->length() );
+
+ if( i_pageNum < 2) {
+ f.at( 0);
+ } else {
+ if(!f.at( pageStopArray[i_pageNum - 1] ))
+ qDebug("File positioned backward did not work");
+ }
+ QString s;
+ // int sizeLine=0;
+ Lview->clear();
+ // QString insertString;
+
+ for(int fd = 0; fd < pageSize ;fd++) {
+ // Lview->removeLine( Lview->PageSize() );
+ f.readLine(s, 256);
+ if(useWrap)
+ s.replace(QRegExp("\n"),"");
+ currentLine++;
+ // insertString+=s;
+ Lview->insertLine( s, -1);
+ }
+
+ // Lview->insertAt( insertString,0,0, FALSE);
+
+ if( !BackButton->autoRepeat() && !BackButton->isDown()) {
+ QString topR;
+ QString lastR;
+ QString pageR;
+ // int sizer = Lview->lastRow() - Lview->topRow();
+ // int i_topRow = Lview->topRow();
+ if( i_pageNum < 1)
+ i_pageNum = 1;
+ setCaption(QString::number(i_pageNum));
+ } else {
+ // int newTop = Lview->Top();
+ // if(Lview->lastRow() > i)
+ Lview->MultiLine_Ex::pageUp( FALSE);
+ // Lview->ScrollDown(1);
+ // i_pageNum--;
+ if( i_pageNum < 1)
+ i_pageNum = 1;
+ setStatus();
+ Lview->setCursorPosition( Lview->Top(), 0, FALSE);
+
+ }
+ }
+ Lview->setFocus();
+}
+
+void Gutenbrowser::doBeginBtn() {
+ if(loadCheck) {
+ qApp->processEvents();
+ BeginBtn();
+ }
+}
+
+ // moves text to the very top = 0
+void Gutenbrowser::TopBtn() {
+
+ if(loadCheck) {
+ if( i_pageNum != 0) {
+ qDebug("top");
+ qApp->processEvents();
+ currentLine = 0;
+ i_pageNum = 1;
+ int pageSize = Lview->PageSize() ;
+ Lview->clear();
+ QString s;
+ f.at(0);
+ for(int fd=0; fd < pageSize ;fd++) {
+ f.readLine(s, 256);
+ if(useWrap)
+ s.replace(QRegExp("\n"),"");
+ Lview->insertLine(s ,-1);
+ currentLine++;
+ }
+ Lview->setCursorPosition( 0,0, FALSE);
+ i_pageNum=1;
+ setStatus();
+ }
+ Lview->setFocus();
+ }
+}
+
+ //moves text to the start of the EText
+void Gutenbrowser::BeginBtn() {
+ i_pageNum = 1;
+ currentLine = 0;
+ QString s_pattern="*END*THE SMALL PRINT";
+ QString sPattern2 = "*END THE SMALL PRINT";
+
+ int pageSize = Lview->PageSize();
+ Lview->clear();
+
+ // int lines = Lview->numLines();
+ int pos = 0;//, i = 0;
+ int i_topRow = Lview->topRow();
+
+ QString LeftText;// = Lview->text();
+
+ int linesPerPage = Lview->lastRow() - Lview->topRow();
+ // int pages = (( linesPerPage / Lview->editSize() ) ) +1;
+ // int pageN = 0;
+ i_pageNum = 1;
+ int lastPage=1;
+ int lineNo=0;
+ QString s;
+ f.at( 0);
+
+ while ( !f.atEnd() ) {
+ f.readLine(s, 256);
+ lineNo++;
+ LeftText = s;
+ currentFilePos = f.at();
+
+ i_pageNum = lineNo/pageSize;
+ if(lastPage < i_pageNum) {
+ pageStopArray.resize(i_pageNum + 1);
+ pageStopArray[i_pageNum ] = currentFilePos;
+ // qDebug("new page number %d, found at %d", i_pageNum, currentFilePos);
+ }
+ // lastPage = i_pageNum;
+ if( LeftText.find( s_pattern, 0 , TRUE) != -1 || LeftText.find( sPattern2, 0 , TRUE) != -1 ) {
+ qDebug("<<<<<< FOUND IT!! new page number %d, found at %d", i_pageNum, currentFilePos);
+ break;
+ }
+ }
+ if(f.atEnd()) //in case we didnt find anything, we need to show something
+ f.at(0);
+ Lview->clear();
+ for(int fd=0; fd < pageSize - 1;fd++) {
+ f.readLine(s, 256);
+ if(useWrap)
+ s.replace(QRegExp("\n"),"");
+ Lview->insertLine( s, -1);
+ currentLine++;
+ }
+
+ i_pageNum = lineNo/pageSize;
+ pageStopArray.resize(i_pageNum + 1);
+ // int length = Lview->length();
+
+ qApp->processEvents();
+
+ if( pos > i_topRow ) {
+ Lview->setCursorPosition( pos+linesPerPage+2/* - i_topRow+3 */,0, FALSE);
+ } else {
+ Lview->setCursorPosition( pos+2 , 0, FALSE );
+ }
+
+ Lview->deselect();
+ // AdjustStatus();
+ Lview->setFocus();
+}
+
+ /*
+ sets the current page and place as a bookmark*/
+void Gutenbrowser::setBookmark() {
+ int eexit=QMessageBox::information(this, "Note",
+ "Do you really want to \nset this bookmark?."
+ ,QMessageBox::Yes, QMessageBox::No);
+ if (eexit== 3) {
+
+ currentFilePos = f.at();
+
+ Config cfg("Gutenbrowser");
+ cfg.setGroup("General");
+ file_name=cfg.readEntry("Current","");
+ qApp->processEvents();
+ qDebug("Settingbook mark "+file_name);
+
+ cfg.setGroup("Titles");
+ title=cfg.readEntry(file_name,"");
+ qDebug("title is "+ title);
+
+ cfg.setGroup( "Bookmarks" );
+
+ cfg.writeEntry("File Name",file_name);
+ cfg.writeEntry("Page Number",QString::number(i_pageNum) );
+ cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1]));
+ cfg.writeEntry("Title", title);
+
+ int row = Lview->topRow();// Lview->Top();
+ cfg.writeEntry("LineNumber",QString::number(row) );
+
+ cfg.setGroup(title);
+ cfg.writeEntry("File Name",file_name);
+ cfg.writeEntry( "LineNumber", QString::number( row));
+ cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1]));
+ cfg.writeEntry( "Page Number", QString::number( i_pageNum) );
+ bookmarksMenu->insertItem( title);
+ }
+} //end setBookmark
+
+
+ /* goes to last set bookmark*/
+void Gutenbrowser::Bookmark( int itemId) {
+
+ // qApp->processEvents();
+ Config config("Gutenbrowser");
+ config.setGroup( "Bookmarks" );
+
+ // qDebug("<<<<<< %d, %d", Lview->PageSize(), Lview->lastRow() - Lview->topRow() );
+
+ QString itemString;
+
+ qDebug("menu item %d", itemId);
+ QString tempTitle;
+ QString s_Bmrkrow;
+ QString s_pageNum;
+ int Bmrkrow=0;
+ int bookmarkPosition = 0;
+
+ // qApp->processEvents();
+ config.setGroup( "Bookmarks" );
+ title = config.readEntry("Title", "");
+ file_name = config.readEntry("File Name", "");
+ i_pageNum = config.readNumEntry("Page Number", 0);
+ bookmarkPosition = config.readNumEntry( "PagePosition",0);
+ Bmrkrow = config.readNumEntry("LineNumber",0);
+ if( !file_name.contains("/")) {
+ file_name = local_library + file_name;
+ }
+
+ // getTitle(file_name);
+ // qApp->processEvents();
+ // Lview->setFocus();
+ this->setFocus();
+
+ Lview->clear();
+
+ load(file_name);
+
+ int pageSize= Lview->PageSize();
+ f.at(0);
+ // Lview->clear();
+ QString s;
+ int lineNo=0;
+ int lastPage=1;
+ while ( !f.atEnd() ) {
+ f.readLine(s, 256);
+ lineNo++;
+ currentFilePos = f.at();
+
+ i_pageNum = lineNo/pageSize;
+ if(lastPage < i_pageNum) {
+ pageStopArray.resize(i_pageNum + 1);
+ pageStopArray[i_pageNum ] = currentFilePos;
+ // qDebug("new page number %d, found at %d", i_pageNum, currentFilePos);
+ }
+ if(currentFilePos == bookmarkPosition)
+ break;
+ }
+ if(f.atEnd())
+ f.at(0);
+ else
+ f.at( bookmarkPosition);
+
+ for(int fd=0; fd < pageSize - 1;fd++) {
+ f.readLine(s, 256);
+ lineNo++;
+ if(useWrap)
+ s.replace(QRegExp("\n"),"");
+ Lview->insertLine( s, -1);
+ currentLine++;
+ }
+
+ i_pageNum = lineNo/pageSize;
+ pageStopArray.resize(i_pageNum + 1);
+
+ if(showMainList) {
+ showMainList=FALSE;
+ mainList->hide();
+ Lview->show();
+ // qApp->processEvents();
+ }
+
+ qDebug("bookmark loaded");
+ setCaption(title);
+}
+
+
+bool Gutenbrowser::load( const char *fileName) {
+
+ // QCopEnvelope ( "QPE/System", "busy()" );
+ // qDebug("Title is already set as "+title);
+ qDebug("sizeHint %d pageSize %d", sizeHint().height(),Lview->PageSize() );
+ if( Lview->PageSize() < 4) {
+
+ Lview->setMaximumHeight( sizeHint().height() );
+ Lview->setMinimumHeight( sizeHint().height() );
+ pointSize = Lview->fontInfo().pointSize();
+ qDebug("sizeHint %d point size %d", sizeHint().height(), pointSize);
+ if(pointSize < 10)
+ Lview->setFixedVisibleLines(19);
+ else
+ Lview->setFixedVisibleLines( ( (sizeHint().height() / pointSize ) * 2) -2);
+ }
+
+ Config cfg("Gutenbrowser");
+ cfg.setGroup("General");
+ cfg.writeEntry("Current",fileName);
+ currentLine=0;
+
+ file_name=fileName;
+ QString o_file = fileName;
+
+ // if (i_pageNum < 1) {
+ i_pageNum = 1;
+ // }
+ qDebug("ready to open "+o_file);
+
+ if(f.isOpen()) f.close();
+ f.setName( o_file);
+
+ if ( !f.open( IO_ReadOnly)) {
+ QMessageBox::message( (tr("Note")), (tr("File not opened sucessfully.\n" +o_file)) );
+ return false;
+ }
+ currentFilePos = 0;
+ pageStopArray.resize(3);
+ pageStopArray[0] = currentFilePos;
+
+ fileHandle = f.handle();
+ QString insertString;
+ QTextStream t(&f);
+ QString s;
+ for(int fd=0; fd < Lview->PageSize() ;fd++) {
+ s=t.readLine();
+ // insertString+=s;
+ if(useWrap)
+ s.replace(QRegExp("\n"),"");
+ // s.replace(QRegExp("\r"),"");
+ Lview->insertLine( s,-1);
+ currentLine++;
+ }
+
+ // int length = Lview->length();
+ currentFilePos = f.at();
+
+ pageStopArray[1] = currentFilePos;
+
+ qDebug("<<<<<<<<<<<%d current page is number %d, length %d, current %d, pageSize %d",
+ currentFilePos, i_pageNum, Lview->length(), pageStopArray[i_pageNum], Lview->PageSize() );
+
+ Lview->setMaxLines(Lview->PageSize()*2);
+ qDebug("Gulped %d", currentLine);
+ setCaption(title);
+ Lview->setAutoUpdate( TRUE);
+
+ Lview->setCursorPosition(0,0,FALSE);
+
+ // pages = (int)(( Lview->numLines() / Lview->editSize() ) / 2 ) +1;
+ //qDebug("number of pages %d", pages);
+
+ loadCheck = true;
+ enableButtons(true);
+ if( donateMenu->count() == 3) {
+ donateMenu->insertItem("Current Title", this, SLOT( InfoBarClick() ));
+ }
+ Lview->setFocus();
+
+ // QCopEnvelope("QPE/System", "notBusy()" );
+ return true;
+} // end load
+
+void Gutenbrowser::Search() {
+
+ // if( searchDlg->isHidden())
+ {
+ qDebug("Starting search dialog");
+ searchDlg = new SearchDialog( this, "Etext Search", true);
+ searchDlg->setCaption( tr( "Etext Search" ));
+ // searchDlg->setLabel( "- searches etext");
+ connect( searchDlg,SIGNAL( search_signal()),this,SLOT( search_slot()));
+ connect( searchDlg,SIGNAL( search_done_signal()),this,SLOT( searchdone_slot()));
+
+ QString resultString;
+ QString string = searchDlg->searchString;
+ Lview->deselect();
+ searchDlg->show();
+ searchDlg->result();
+ }
+}
+
+void Gutenbrowser::search_slot( ) {
+ int line, col;
+ if (!searchDlg /*&& !loadCheck */)
+ return;
+
+ Lview->getCursorPosition(&line,&col);
+ QString to_find_string=searchDlg->get_text();
+
+ // searchDlg->get_direction();// is true if searching backward
+ if ( last_search != 0 && searchDlg->get_direction() ){
+ col = col - pattern.length() - 1 ;
+ }
+ again:
+ int result = doSearch( to_find_string , /* searchDlg->case_sensitive()*/ TRUE, searchDlg->forward_search(), line, col);
+ if(result == 0){
+ if(!searchDlg->get_direction()){ // forward search
+ int query = QMessageBox::information( searchDlg, "Find",
+ "End of document reached.\nContinue from the beginning?",
+ "Yes", "No", "", 0,1);
+ if (query == 0){
+ line = 0;
+ col = 0;
+ goto again;
+ }
+ } else { //backward search
+ int query = QMessageBox::information( searchDlg, "Find",
+ "End of document reached.\nContinue from the beginning?",
+ "Yes", "No", "", 0,1);
+ if (query == 0){
+ QString string = Lview->textLine( Lview->numLines() - 1 );
+ line = Lview->numLines() - 1;
+ lineCheck = line;
+ col = string.length();
+ last_search = -1; //BACKWARD;
+ goto again;
+ }
+ }
+ } else {
+
+ //// emit CursorPositionChanged(); textLine
+ }
+}
+
+int Gutenbrowser::doSearch( const QString &s_pattern , bool case_sensitive, bool forward, int line, int col ) {
+ int i, length;
+ int pos = -1;
+ if(forward) {
+ QString string;
+ for(i = line; i < Lview->numLines(); i++) {
+
+ string = Lview->textLine(i);
+ pos = string.find(s_pattern, i == line ? col : 0, case_sensitive);
+ if( pos != -1) {
+ int top = Lview->Top();
+ length = s_pattern.length();
+ if( i > Lview->lastRow() ) {
+ Lview->setCursorPosition(i,pos,FALSE);
+ for(int l = 0 ; l < length; l++) {
+ Lview->cursorRight(TRUE);
+ }
+ Lview->setCursorPosition( i , pos + length, TRUE );
+ int newTop = Lview->Top();
+ if(Lview->lastRow() > i)
+ Lview->ScrollUp( newTop - top);
+ // AdjustStatus();
+ } else {
+ Lview->setCursorPosition(i,pos,FALSE);
+ for(int l = 0 ; l < length; l++) {
+ Lview->cursorRight(TRUE);
+ }
+ Lview->setCursorPosition( i , pos + length, TRUE );
+ // AdjustStatus();
+ }
+ pattern = s_pattern;
+ last_search = 1; //FORWARD;
+ return 1;
+ }
+ }
+ } else { //////////////// searching backwards
+ QString string;
+ for( i = line; i >= 0; i--) {
+ string = Lview->textLine(i);
+ int line_length = string.length();
+ pos = string.findRev(s_pattern, line == i ? col : line_length , case_sensitive);
+ if (pos != -1) {
+ // int top = Lview->Top();
+ length = s_pattern.length();
+ if( i < Lview->Top() ) {
+ Lview->ScrollDown( Lview->PageSize() );
+ Lview->MultiLine_Ex::pageUp( FALSE );
+ if( ! (line == i && pos > col ) ) {
+ Lview->setCursorPosition( i ,pos ,FALSE );
+ for(int l = 0 ; l < length; l++) {
+ Lview->cursorRight(TRUE);
+ }
+ Lview->setCursorPosition(i ,pos + length ,TRUE );
+ // int newTop = Lview->Top();
+ /* if(useSplitter) Rview->ScrollUp( newTop - top);
+ */ }
+ } else {
+ if( ! (line == i && pos > col ) ) {
+ Lview->setCursorPosition( i, pos, FALSE );
+ for( int l = 0 ; l < length; l++) {
+ Lview->cursorRight( TRUE);
+ }
+ Lview->setCursorPosition( i, pos + length, TRUE );
+ }
+ pattern = s_pattern;
+ last_search = -1;
+ return 1;
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+void Gutenbrowser::LibraryBtn() {
+
+ QString newestLibraryFile ="pgwhole.zip";
+ QString zipFile;
+ // qDebug("Local Library is %s ", local_library.latin1());
+ zipFile="/usr/bin/unzip";
+ // qDebug("newestLibraryFile is %s ", newestLibraryFile.latin1());
+ if( QFile::exists( local_library+newestLibraryFile)) {
+ if( QFile::exists(zipFile) ) {
+ UnZipIt(newestLibraryFile);
+ }
+ else
+ QMessageBox::message( "Note",( tr("Please install unzip")) );
+ }
+ // LibraryDlg = new LibraryDialog( this, "Library Index");
+ LibraryDlg->setCaption( tr( "Gutenberg Library"));
+ Config config("Gutenbrowser");
+ config.setGroup("General");
+ QString tmp=config.readEntry("RunBefore","FALSE");
+ if(tmp=="FALSE") {
+ QMessageBox::message( "Note",
+ "<P>Your first time running gutenbrowser. You'll need to click the \"load library\" button to load the gutenberg index.</P>");
+ config.writeEntry("RunBefore","TRUE");
+ }
+ if(useSplitter)
+ LibraryDlg->useSmallInterface=FALSE;
+
+ LibraryDlg->showMaximized();
+
+ if( LibraryDlg->exec() != 0 ) {
+ listItemNumber = LibraryDlg->DlglistItemNumber;
+ listItemFile = LibraryDlg->DlglistItemFile;
+ listItemYear = LibraryDlg->DlglistItemYear;
+ listItemTitle = LibraryDlg->DlglistItemTitle;
+ file_name = LibraryDlg->File_Name;
+ // qDebug("title is being set as "+title);
+ title = listItemTitle;
+
+ // config.setGroup( "Proxy" );
+ // if( LibraryDlg->checked == 1) {
+ // config.writeEntry("IsChecked", "TRUE");
+ // } else {
+ // config.writeEntry("IsChecked", "FALSE");
+ // }
+ // config.write();
+ // config.read();
+ if ( listItemNumber.isNull()) {
+ } else {
+ i_pageNum = 1;
+ if( file_name !="Error" && file_name.length() >2 && !file_name.isEmpty() ) {
+ //replace .zip with txt for opening it.
+ // printf("\nFile name is now\n");
+ // printf(file_name);
+ // printf("\n");
+ //
+ if( file_name.find(".zip"))
+ {
+ qDebug("Found zip file\n");
+ // QStringList args;
+ // args="unzip";
+ // args+="-o";
+ // args+=local_library+file_name;
+ // args+="-d";
+ // args+=local_library;
+ QString cmd = "/usr/bin/unzip -o " + local_library+file_name + " -d " + local_library;
+ qDebug("Issuing the command "+ cmd);
+ // unzipProc=new QProcess( this, "unzipProc" ); /// fark that idea!
+ // unzipProc->start();
+ system(cmd);
+ remove( file_name);
+
+ }
+ // //
+ // file_name = file_name.left(4)+ ".txt";
+ if( LibraryDlg)
+ delete LibraryDlg;
+ setTitle();
+ // QCopEnvelope ( "QPE/System", "busy()" );
+ load( file_name);
+ } else {
+ printf("Not opening the file.\n");
+ }
+ }
+ }
+ if(showMainList) {
+ if(!Lview->isHidden())
+ Lview->hide();
+ qApp->processEvents();
+ showMainList=TRUE;
+ if(mainList->isHidden())
+ mainList->show();
+ fillWithTitles();
+ qApp->processEvents();
+ } else
+ setCentralWidget( Lview);
+ // QPEApplication::grabKeyboard();
+ // fixKeys();
+}
+
+void Gutenbrowser::OpenBtn() {
+ QString s_temp;
+ s_temp = status;
+ OpenEtext* OpenDlg;
+ OpenDlg = new OpenEtext(this,"OpenDlg");
+ OpenDlg->showMaximized();
+
+ if( OpenDlg->exec() != 0) {
+ title = OpenDlg->openFileTitle;
+ qDebug("title open as "+title);
+ file_name = OpenDlg->file;
+ i_pageNum = 1;
+
+ if( !file_name.isEmpty() || file_name.length() > 2 ) {
+ if(showMainList) {
+ showMainList=FALSE;
+ qDebug("ShowMainList is now false");
+ mainList->hide();
+ Lview->show();
+ qApp->processEvents();
+ }
+ Lview->clear();
+ // QCopEnvelope ( "QPE/System", "busy()" );
+ load(file_name);
+ } else {
+ qDebug("file_name is empty!");
+ if(showMainList) {
+ if(!Lview->isHidden())
+ Lview->hide();
+ qApp->processEvents();
+ if(mainList->isHidden())
+ mainList->show();
+ fillWithTitles();
+ qApp->processEvents();
+ }
+
+ }
+ }
+ if( OpenDlg)
+ delete OpenDlg;
+ /*
+ Config config("Gutenbrowser");
+ config.setGroup( title);
+ file_name = config.readEntry("File Name", "");
+ i_pageNum = config.readNumEntry("Page Number", -1);
+ int Bmrkrow = config.readNumEntry("LineNumber", -1);
+ if(Bmrkrow > -1) {
+ if( Bmrkrow > Lview->topRow() ) {
+ Lview->setCursorPosition( Bmrkrow ,0, FALSE );
+ Lview->ScrollUp( Bmrkrow - Lview->topRow() );
+ // AdjustStatus();
+ }
+ else if( Bmrkrow < Lview->topRow() ) {
+ Lview->setCursorPosition( Lview->topRow() - Bmrkrow ,0, FALSE );
+ Lview->ScrollDown( Lview->topRow() - Bmrkrow );
+ // AdjustStatus();
+ }
+ }
+ */
+ // ResizeEdits();
+
+}
+
+void Gutenbrowser::ChangeFont() {
+#ifndef Q_WS_QWS
+ bool ok;
+
+ weight= Lview->fontInfo().weight();
+ italic = Lview->fontInfo().italic();
+ bold=Lview->fontInfo().bold();
+ pointSize= Lview->fontInfo().pointSize();
+ fontStr=Lview->fontInfo().family();
+
+ if(italic == true)
+ italicStr="TRUE";
+ else
+ italicStr="FALSE";
+
+ QFont currentfont( fontStr, pointSize, weight, italic );
+
+ if (ok) {
+ QFontInfo fontInfo(font );
+ fontStr=fontInfo.family();
+
+ pointSize= fontInfo.pointSize();
+
+ font.setFontSize(pointSize);
+
+ pointSizeStr.setNum( pointSize);
+
+ weight= fontInfo.weight();
+ weightStr.setNum( weight);
+ italic =fontInfo.italic();
+ bold=fontInfo.bold();
+
+ if(italic == true)
+ italicStr="TRUE";
+ else
+ italicStr="FALSE";
+ if(bold == true)
+ boldStr="TRUE";
+ else
+ boldStr="FALSE";
+
+ pointSizeStr.setNum( pointSize);
+ config.setGroup( "Font" );
+ config.writeEntry("Family", fontStr );
+ config.writeEntry("Size", pointSizeStr );
+ config.writeEntry("Weight", weightStr );
+ config.writeEntry("Italic", italicStr );
+ config.writeEntry("Bold", boldStr );
+ // config.write();
+
+ Lview->setFont(font);
+
+ QRect lRect;
+ QRect rRect;
+ lRect = Lview->rect();
+ if(useSplitter) {
+ }
+ // if(loadCheck) {
+ // ResizeEdits();
+ // }
+ update();
+ }
+#endif
+}
+
+
+ /*
+ performs dictionary look ups on the web */
+void Gutenbrowser::LookupBtn() {
+ QString text;
+ if( Lview->hasSelectedText()) {
+ Lview->copy();
+ }
+ QClipboard *cb = QApplication::clipboard();
+ text = cb->text();
+ int eexit=QMessageBox::information(this,
+ "Note","Do you want to lookup\n\""+text+"\"\non websters web dictionary?",
+ QMessageBox::Yes, QMessageBox::No);
+ if (eexit== 3) {
+ // this link for sale!!
+ qApp->processEvents();
+ goGetit( "http://www.m-w.com/cgi-bin/dictionary?" + text, true);
+ }
+}
+
+void Gutenbrowser::ClearEdit() {
+ Lview->setText("");
+ loadCheck = false;
+ status = ( tr("Gutenbrowser"));
+ InfoBar->setText( "");
+ setCaption( tr("Gutenbrowser"));
+ i_pageNum = 0;
+ enableButtons(false);
+
+ if(!showMainList) {
+ Lview->hide();
+ showMainList=TRUE;
+ mainList->show();
+ fillWithTitles();
+ qApp->processEvents();
+ }
+ if(donateMenu->idAt(3) != -1)
+ donateMenu->removeItemAt(3);
+}
+
+
+bool Gutenbrowser::getTitle( const char *file ) {
+ QString s_file;
+ QString filer = file;
+ if( filer.contains(local_library, TRUE)) {
+ QFileInfo f(file);
+ s_file = f.fileName();
+ } else {
+ s_file = filer;
+ }
+ Config config("Gutenbrowser");
+ config.setGroup( "Files" );
+ QString s_numofFiles = config.readEntry("NumberOfFiles", "0" );
+ int i_numofFiles = s_numofFiles.toInt();
+
+ for (int i = 1; i <= i_numofFiles; i++) {
+ QString temp;
+ temp.setNum(i);
+ QString ramble = config.readEntry(temp, "" );
+
+ if( strcmp(ramble, s_file) == 0) {
+ config.setGroup( "Titles" );
+ title = config.readEntry(ramble, "");
+ // qDebug("(getTitle)title is being set as "+title);
+ }
+ }
+ return true;
+}
+
+void Gutenbrowser::searchdone_slot() {
+ // if (!searchDlg)
+ // return;
+ // searchDlg->hide();
+ // Lview->setFocus();
+ this->setFocus();
+ last_search = 0;
+ // ResizeEdits();
+}
+
+ /*
+ sets the status message */
+bool Gutenbrowser::setStatus() {
+
+#ifndef Q_WS_QWS
+ QString s_pages;
+ s_pages.setNum( pages);
+ QString chNum;
+ statusTop = status.left( status.find(" ", TRUE) );
+ status.append(chNum.setNum( i_pageNum));
+ status += " / " + s_pages;
+
+ if(loadCheck) {
+ statusBar->message( status);
+ InfoBar->setText( title);
+ } else {
+ }
+#else
+ QString msg;
+ msg.sprintf(title+" %d", i_pageNum);
+ setCaption( msg);
+#endif
+ return true;
+}
+
+void Gutenbrowser::keyReleaseEvent( QKeyEvent *e) {
+ switch ( e->key() ) {
+
+ case Key_M:
+ // Bookmark();
+ break;
+ case Key_D:
+ DownloadIndex();
+ break;
+ case Key_L:
+ LibraryBtn();
+ break;
+ case Key_O:
+ OpenBtn();
+ break;
+ case Key_F:
+ ForwardBtn();
+ break;
+ case Key_B:
+ BackBtn();
+ break;
+ case Key_P:
+ PrintBtn();
+ break;
+ case Key_S:
+ SearchBtn();
+ break;
+ case Key_E:
+ ByeBye();
+ break;
+ case Key_R:
+ // setBookmark();
+ break;
+ case Key_T:
+ ChangeFont();
+ break;
+ case Key_C:
+ ClearEdit();
+ break;
+ case Key_H:
+ HelpBtn();
+ break;
+ case Key_K:
+ LookupBtn();
+ break;
+ case Key_U:// hide menu
+ if(menubar->isHidden() )
+ menubar->show();
+ else
+ menubar->hide();
+ break;
+ case Key_I:
+ hideButtons();
+ break;
+ ////////////////////////////// Zaurus keys
+ case Key_Home:
+ // BeginBtn();
+ break;
+ case Key_F9: //activity
+ OpenBtn();
+ break;
+ case Key_F10: //contacts
+ hideButtons();
+ break;
+ case Key_F11: //menu
+ if(menubar->isHidden() )
+ menubar->show();
+ else
+ menubar->hide();
+ break;
+ case Key_F12: //home
+ BeginBtn();
+ break;
+ case Key_F13: //mail
+ LibraryBtn();
+ break;
+ case Key_Space:
+ if(loadCheck)
+ ForwardBtn();
+ // else
+ // Bookmark();
+ break;
+ case Key_Down:
+ if(loadCheck) {
+ // if( !e->isAutoRepeat() )
+ // AdjustStatus();
+ // } else {
+ // LibraryBtn();
+ // ForwardBtn();
+ }
+
+ // ForwardButton->setFocus();
+ // Lview->setFocus();
+ // if(s_Wrap=="FALSE")
+ // Lview->MultiLine_Ex::ScrollDown( 1);
+ // LibraryBtn();
+ break;
+ case Key_Up:
+ if(loadCheck) {
+ // if( !e->isAutoRepeat() )
+ // AdjustStatus();
+ // } else {
+ // OpenBtn();
+ // BackBtn();
+ }
+ // BackButton->setFocus();
+ // Lview->setFocus();
+ // if(s_Wrap=="FALSE")
+ // Lview->MultiLine_Ex::ScrollUp( 1);
+
+ // LibraryBtn();
+ break;
+ case Key_Right:
+ ForwardButton->setFocus();
+ ForwardBtn();
+ // LibraryBtn();
+ break;
+ case Key_Left:
+ BackBtn();
+ BackButton->setFocus();
+ // OpenBtn();
+ break;
+ case Key_Escape:
+ ByeBye();
+ break;
+ case Key_PageUp:
+ BackBtn();
+ break;
+ case Key_PageDown:
+ ForwardBtn();
+ break;
+
+ ////////////////////////////// Zaurus keys
+ };
+}
+
+void Gutenbrowser::keyPressEvent( QKeyEvent *e) {
+ switch ( e->key() ) {
+ // case Key_Next:
+ // ForwardBtn();
+ // break;
+ // case Key_Prior:
+ // BackBtn();
+ // break;
+ // case Key_Space:
+ // ForwardBtn();
+ // break;
+ // case Key_Down:
+ // Lview->MultiLine_Ex::ScrollUp( 1);
+ // if(useSplitter) Rview->MultiLine_Ex::ScrollUp( 1);
+ // break;
+ // case Key_Up:
+ // if( Lview->Top() != 0) {
+ // Lview->MultiLine_Ex::ScrollDown( 1);
+ // if(useSplitter) Rview->MultiLine_Ex::ScrollDown( 1);
+ // }
+ // break;
+ }
+}
+
+void Gutenbrowser::resizeEvent( QResizeEvent *ev) {
+ // qDebug("resize: %d,%d\n",ev->size().width(),ev->size().height());
+
+ if( !LibraryDlg->isHidden())
+ LibraryDlg->resize(ev->size().width(),ev->size().height() );
+
+ // if( loadCheck == true) {
+ // ResizeEdits();
+ // AdjustStatus();
+ // }
+}
+
+
+void Gutenbrowser::doOptions() {
+ optionsDialog* optDlg;
+ optDlg = new optionsDialog( this,"Options_Dlg", true);
+ QString Ddir;
+ Config config("Gutenbrowser");
+ config.setGroup( "General" );
+ QFont myFont;
+ optDlg->showMaximized();
+
+ if( optDlg->exec() !=0) {
+ qApp->processEvents();
+ brow=optDlg->browserName;
+ toggleButtonIcons( optDlg->useIcon);
+ ftp_host= optDlg->ftp_host;
+ ftp_base_dir= optDlg->ftp_base_dir;
+ brow=optDlg->browserName;
+ Ddir=optDlg->downloadDirEdit->text();
+
+ qDebug("writing library config");
+ Config config("Gutenbrowser");
+ config.setGroup("General");
+
+ QString dirname= optDlg->downloadDirEdit->text();
+ if(dirname.right(1)!="/")
+ dirname+="/";
+ config.writeEntry( "DownloadDirectory",dirname);
+ QDir newDir( optDlg->downloadDirEdit->text());
+
+ if( !newDir.exists() ) {
+ int exit=QMessageBox::information(this, "Note", "Ok, to make a new directory\n"+Ddir+" ?",
+ QMessageBox::Ok, QMessageBox::Cancel);
+ if (exit==1) {
+ QString cmd="mkdir -p ";
+ cmd+=Ddir.latin1();
+ system(cmd);
+ qDebug("Making new dir "+cmd);
+ if(Ddir.right(1)!="/") {
+ Ddir+="/";
+ }
+ config.writeEntry("DownloadDirectory",Ddir);
+ }
+ }
+
+// if(optDlg->styleChanged)
+// setStyle( optDlg->styleInt);
+ if(optDlg->b_qExit==TRUE)
+ b_queryExit=TRUE;
+ else
+ b_queryExit=FALSE;
+
+ if(optDlg->fontDlg-> changedFonts) {
+ qDebug("Setting font");
+ myFont=optDlg->fontDlg->selectedFont;
+ Lview->setFont( myFont);
+ }
+
+ if(optDlg->useWordWrap_CheckBox->isChecked() ) {
+ qDebug("WORD WRAP is set");
+ Lview->setWordWrap(QMultiLineEdit::WidgetWidth);
+ useWrap=true;
+ } else {
+ qDebug("Word wrap is NOT set");
+ Lview->setWordWrap(QMultiLineEdit::NoWrap);
+ useWrap=false;
+ }
+ }
+ if(showMainList) {
+ if(!Lview->isHidden())
+ Lview->hide();
+ qApp->processEvents();
+ if(mainList->isHidden())
+ mainList->show();
+ fillWithTitles();
+ } else {
+ Lview->show();
+ showMainList=FALSE;
+ mainList->hide();
+ }
+ qApp->processEvents();
+ update();
+}
+
+bool Gutenbrowser::setTitle() {
+ if( file_name.contains( local_library)) {
+ QFileInfo f( file_name);
+ QString s_file = f.fileName();
+ file_name = s_file;
+ }
+
+ int test = 0;
+ Config config("Gutenbrowser");
+ config.setGroup( "Files" );
+ QString s_numofFiles = config.readEntry("NumberOfFiles", "0" );
+ int i_numofFiles = s_numofFiles.toInt();
+
+ for (int i = 1; i <= i_numofFiles; i++) {
+ QString temp;
+ temp.setNum(i);
+ QString ramble = config.readEntry(temp, "" );
+
+ if( strcmp(ramble, file_name) == 0) {
+ test = 1;
+ }
+ }
+ if (test == 0) {
+ config.writeEntry("NumberOfFiles",i_numofFiles +1 );
+ QString interger;
+ interger.setNum( i_numofFiles +1);
+ config.writeEntry(interger, file_name);
+
+ config.setGroup( "Titles" );
+ config.writeEntry(file_name,listItemTitle);
+ }
+ test = 0;
+ // config.write();
+ return true;
+}
+ /*Calls new fangled network dialog */
+void Gutenbrowser::OnNetworkDialog( const QString &/*networkUrl*/, const QString &/*output*/)
+{
+ // qDebug(networkUrl);
+ // qDebug(output);
+ // #ifndef Q_WS_QWS
+ // NetworkDialog *NetworkDlg;
+ // if( networkUrl.length() < 4 ) networkUrl= "http://sailor.gutenberg.org/mirror.sites.html";
+ // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkUrl, output);
+ // if( NetworkDlg->exec() != 0 ) {
+ // }
+ // if(NetworkDlg)
+ // delete NetworkDlg;
+ // #endif
+}
+
+void Gutenbrowser::donateGutenberg()
+{
+ int exit=QMessageBox::information(this, "Info", "http://www.gutenberg.org\ndonate@gutenberg.net",
+ QMessageBox::Ok, QMessageBox::Cancel);
+
+ if (exit==1) {
+ } else {
+ };
+}
+
+void Gutenbrowser::donateByteMonkie()
+{
+}
+
+void Gutenbrowser::writeConfig()
+{
+ // config.read();
+ // Config config("Gutenbrowser");
+ // #ifndef Q_WS_QWS
+ // config.setGroup( "Geometry" );
+ // QString s;
+ // QString globalPosition;
+ // QPoint point;
+ // point=mapToGlobal(QPoint(0,0) );
+ // int posiX, posiY;
+ // posiX=point.x();
+ // posiY=point.y();
+ // globalPosition.sprintf("%i,%i", posiX, posiY);
+
+ // QRect frameRect;
+ // frameRect = geometry();
+ // s.sprintf("%i,%i", frameRect.width(), frameRect.height());
+ // config.writeEntry("Frame", s);
+ // config.writeEntry("Position", globalPosition);
+
+ // if( useIcons==TRUE)
+ // config.writeEntry("Icons", "TRUE");
+ // else
+ // config.writeEntry("Icons", "FALSE");
+ // #endif
+
+ // #ifndef Q_WS_QWS
+ // QString temp;
+ // temp.setNum(styleI, 10);
+ // config.setGroup( "StyleIze" );
+ // config.writeEntry( "Style", temp);
+ // #endif
+
+ // config.setGroup("General");
+}
+
+void Gutenbrowser::annotations()
+{
+ // #ifndef Q_WS_QWS
+ // QMessageBox::message("Note","hi annotate");
+ // lastBmkButton->setDown(FALSE);
+ // #endif
+}
+
+void Gutenbrowser::hideButtons()
+{
+
+ if( !buttonsHidden) {
+ buttonsHidden=TRUE;
+ LibraryButton->hide();
+ SearchButton->hide();
+ InfoBar->hide();
+ OpenButton->hide();
+ BackButton->hide();
+ ForwardButton->hide();
+ setBookmarkButton->hide();
+ lastBmkButton->hide();
+ dictionaryButton->hide();
+ if(useSplitter) {
+ ClearButton->hide();
+ PrintButton->hide();
+ beginButton->hide();
+ HelpButton->hide();
+ FontButton->hide();
+ ExitButton->hide();
+ OptionsButton->hide();
+ DownloadButton->hide();
+ }
+ } else {
+ buttonsHidden=FALSE;
+
+ LibraryButton->show();
+ SearchButton->show();
+ InfoBar->show();
+ OpenButton->show();
+ BackButton->show();
+ ForwardButton->show();
+ setBookmarkButton->show();
+ lastBmkButton->show();
+ dictionaryButton->show();
+ if(useSplitter) {
+ ClearButton->show();
+ PrintButton->show();
+ beginButton->show();
+ HelpButton->show();
+ FontButton->show();
+ ExitButton->show();
+ OptionsButton->show();
+ DownloadButton->show();
+ }
+ }
+}
+
+void Gutenbrowser::focusInEvent( QFocusEvent* )
+{
+}
+void Gutenbrowser::focusOutEvent( QFocusEvent* )
+{
+}
+
+void Gutenbrowser::cleanUp( )
+{
+ writeConfig();
+ QPEApplication::grabKeyboard();
+
+ QPEApplication::ungrabKeyboard();
+ // qDebug("Cleanup");
+ if(f.isOpen()) f.close();
+}
+
+void Gutenbrowser::fixKeys()
+{
+ qDebug("Attempting to fix keys");
+
+}
+
+void Gutenbrowser::enableButtons(bool b)
+{
+ BackButton->setEnabled(b);
+ ForwardButton->setEnabled(b);
+ SearchButton->setEnabled(b);
+ setBookmarkButton->setEnabled(b);
+ dictionaryButton->setEnabled(b);
+ InfoBar->setEnabled(b);
+
+ editMenu->setItemEnabled( -5, b);
+ editMenu->setItemEnabled( -6, b);
+ editMenu->setItemEnabled( -7, b);
+ editMenu->setItemEnabled( -8, b);
+
+}
+
+void Gutenbrowser::fillWithTitles() {
+ Config config("Gutenbrowser");
+ config.setGroup( "Files" );
+ int i_numofFiles = config.readNumEntry("NumberOfFiles", 0);
+ mainList->clear();
+ QString temp;
+ for (int i = 1; i <= i_numofFiles; i++) {
+ temp.setNum(i);
+ config.setGroup( "Files" );
+ QString ramble = config.readEntry(temp, "" );
+ config.setGroup( "Titles" );
+ temp = config.readEntry(ramble, "");
+ if( !temp.isEmpty()) {
+ mainList->insertItem ( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), temp, -1);
+ }
+ }
+}
+
+void Gutenbrowser::listClickedSlot( QListBoxItem * index) {
+ // if( !working) {
+ // working=true;
+ if(index) {
+ // QCopEnvelope ( "QPE/System", "busy()" );
+ title = index->text();
+ showMainList=FALSE;
+ mainList->hide();
+ Lview->show();
+ qApp->processEvents();
+ QString temp;
+ temp.setNum( mainList->currentItem() + 1);
+ // openFileTitle = title;
+ Config config("Gutenbrowser");
+ config.setGroup( "Files" );
+ QString file = config.readEntry(temp, "");
+ qDebug("About to load");
+ if( Lview->isVisible())
+ load(file);
+
+ config.setGroup( title);
+ file_name = config.readEntry("File Name", "");
+ i_pageNum = config.readNumEntry("Page Number", 1);
+ int Bmrkrow = config.readNumEntry("LineNumber", -1);
+ if(Bmrkrow > -1) {
+ if( Bmrkrow > Lview->topRow() ) {
+ Lview->setCursorPosition( Bmrkrow /* - Lview->topRow() */,0, FALSE );
+ Lview->ScrollUp( Bmrkrow - Lview->topRow() );
+ // AdjustStatus();
+ }
+ else if( Bmrkrow < Lview->topRow() ) {
+ Lview->setCursorPosition( Lview->topRow() - Bmrkrow ,0, FALSE );
+ Lview->ScrollDown( Lview->topRow() - Bmrkrow );
+ // AdjustStatus();
+ }
+ }
+ }
+}
+
+void Gutenbrowser::infoGutenbrowser() {
+ QMessageBox::message("Info","Gutenbrowser was developed by\n"
+ "Lorn Potter\n"
+ "ljp<ljp@llornkcor.com>\n");
+}
+
+void Gutenbrowser::setDocument(const QString & frozenBoogers) {
+ this->hide();
+ if(showMainList) {
+ showMainList=FALSE;
+ if(!mainList->isHidden())
+ mainList->hide();
+ if(Lview->isHidden())
+ Lview->show();
+ qApp->processEvents();
+ }
+ DocLnk lnk;
+ lnk = DocLnk(frozenBoogers);
+ // qDebug(lnk.file() );
+ title=lnk.comment();
+ load( lnk.file());
+ this->show();
+ // qDebug(title);
+ // qApp->processEvents();
+ // repaint();
+}
+
+void Gutenbrowser::mainListPressed(int mouse, QListBoxItem * , const QPoint & )
+{
+ switch (mouse) {
+ case 1:
+ break;
+ case 2: {
+ QPopupMenu m;// = new QPopupMenu( Local_View );
+ m.insertItem( tr( "Open" ), this, SLOT( menuOpen() ));
+ m.insertSeparator();
+ m.insertItem( tr( "Search google.com" ), this, SLOT( menuGoogle()));
+ m.insertItem( tr( "Edit Title" ), this, SLOT( menuEditTitle()));
+ // m.insertSeparator();
+ // m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
+ m.exec( QCursor::pos() );
+ }
+ break;
+ };
+}
+
+void Gutenbrowser::menuOpen() {
+ listClickedSlot( mainList->item( mainList->currentItem()));
+}
+
+void Gutenbrowser::menuGoogle() {
+ searchGoogle( mainList->text(mainList->currentItem()));
+}
+
+void Gutenbrowser::searchGoogle( const QString &tempText) {
+ QString text = tempText;
+
+ int eexit=QMessageBox::information(this, "Note","Do you want to search for\n"+text+
+ "\non google.com?",QMessageBox::Yes, QMessageBox::No);
+ if (eexit== 3) {
+ qApp->processEvents();
+ text.replace( QRegExp("\\s"), "%20");
+ text.replace( QRegExp("#"), "");
+ text.replace( QRegExp(","), "%20");
+ text.replace( QRegExp("'"), "%20");
+ text.replace( QRegExp("("), "");
+ text.replace( QRegExp(")"), "");
+ // text.replace( QRegExp("[0-9]"), "");
+ QString s_lookup = "http://google.com/search?q="+text+"&num=30&sa=Google+Search";
+ goGetit( s_lookup, true);
+ }
+
+}
+
+void Gutenbrowser::menuEditTitle()
+{
+ int currentItem = mainList->currentItem();
+ QString title_text = mainList->text( currentItem);
+ //qDebug("Selected "+title_text);
+
+ Config config("Gutenbrowser");
+ config.setGroup( "Files" );
+ QString s_numofFiles = config.readEntry("NumberOfFiles", "0");
+ int i_numofFiles = s_numofFiles.toInt();
+ QString fileNum;
+ for (int i = 1; i <= i_numofFiles+1; i++) {
+
+ fileNum.setNum(i);
+ config.setGroup( "Files" );
+ QString s_filename = config.readEntry(fileNum, "" );
+ config.setGroup( "Titles" );
+ QString file_title = config.readEntry( s_filename, "");
+ //qDebug("file_title is "+file_title);
+ if(title_text == file_title ) {
+ // selFile = s_filename;
+ //qDebug("Edit: "+ file_title );
+ i=i_numofFiles+1;
+ Edit_Title *titleEdit;
+ titleEdit = new Edit_Title(this,file_title ,TRUE);
+ if(titleEdit->exec() !=0) {
+ //qDebug(titleEdit->newTitle);
+ config.writeEntry( s_filename, titleEdit->newTitle);
+ mainList->removeItem(currentItem);
+ mainList->insertItem ( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), titleEdit->newTitle, currentItem);
+ }
+ }
+ }
+
+ // getTitles();
+ mainList->triggerUpdate(true);
+
+}
+
+
+
+bool Gutenbrowser::UnZipIt(const QString &zipFile) {
+ qDebug(zipFile);
+#ifndef Q_WS_QWS
+ if( QFile::exists( zipFile)) { // TODO findsome other way of dealingwithzip files.
+ bool isPgWhole=false;
+ QString thatFile;
+ if(zipFile.find("pgwhole",0,TRUE)) {
+ isPgWhole=TRUE;
+ thatFile= local_library +"PGWHOLE.TXT";
+ }
+ // else {
+ // thatFile=zipFile.left(4);
+ // }
+ // qDebug((const char*)local_library.latin1());
+ QString cmd;
+#if defined(_WS_X11_)
+ if( chdir((const char*)local_library.latin1())!=0)
+ qDebug("chdir failed.");
+ cmd = "gunzip -S .zip " + local_library+zipFile;
+ //cmd = "gunzip -d " + zipFile /*newestLibraryFile */+" -d " + local_library;
+#endif
+#ifdef Q_WS_QWS
+ if( chdir((const char*)local_library.latin1())!=0)
+ qDebug("chdir failed.");
+ cmd = "unzip " + local_library+zipFile;
+ // cmd = "/usr/bin/unzip -o " + local_library+zipFile +" -d /usr/share/doc/gutenbrowser" ;//+ local_library;
+#endif
+ int exit=QMessageBox::information(this, "Ok to unzip?",
+ "Ok to unnzip\n"+ zipFile+" ?",
+ QMessageBox::Yes, QMessageBox::No);
+ if (exit==QMessageBox::Yes) {
+#if defined(_WS_X11_)//
+ qDebug("Issuing the command "+cmd);
+ system( cmd);
+ if( QFile::exists(thatFile))
+ remove (thatFile);
+ if(isPgWhole) {
+ if( rename("pgwhole","PGWHOLE.TXT") !=0)
+ qDebug("rename failed");
+ } else {
+ if( rename(thatFile.left(4),thatFile.left(4)+".txt") !=0)
+ qDebug("rename failed");
+ }
+#endif
+#ifdef Q_WS_QWS
+ qDebug("Issuing the command "+cmd);
+ system( cmd);
+ if( QFile::exists(thatFile))
+ remove(thatFile);
+ if(isPgWhole) {
+ if( rename("pgwhole","PGWHOLE.TXT") !=0)
+ qDebug("rename failed");
+ } else {
+ if( rename(thatFile.left(4),thatFile.left(4)+".txt") !=0)
+ qDebug("rename failed");
+ }
+#endif
+ // remove( zipFile);
+ return true;
+ }
+ else if(exit==QMessageBox::No) {
+ // qDebug("unzip");
+ return false;
+ }
+ }
+ else
+ QMessageBox::message( "Note",( tr("Please install unzip in your PATH")) );
+#endif
+ return false;
+}
+
+
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.h b/noncore/apps/opie-gutenbrowser/gutenbrowser.h
new file mode 100644
index 0000000..acb6e59
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.h
@@ -0,0 +1,226 @@
+/***************************************************************************
+ gutenbrowser.h - description
+ -------------------
+ begin : Mon Jul 24 22:33:12 MDT 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+***************************************************************************/
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+#ifndef GUTENBROWSER_H
+#define GUTENBROWSER_H
+
+class QPainter;
+class QPushButton;
+class QListView;
+class QString;
+class QTextView;
+class QPopupMenu;
+class QMenuBar;
+class QToolBar;
+class QLayout;
+class QToolTip;
+class QPixMap;
+class QFile;
+
+#include <qtoolbutton.h>
+
+#include <qpe/qpeapplication.h>
+#include <qpe/qpemenubar.h>
+#include <qpe/menubutton.h>
+
+#include <qmainwindow.h>
+#include <qapplication.h>
+#include <qwhatsthis.h>
+#include <qfontmetrics.h>
+#include <qfontinfo.h>
+#include <qpoint.h>
+
+#include "LibraryDialog.h"
+#include "multiline_ex.h"
+#include "resource.h"
+
+#include <qvaluelist.h>
+
+class Gutenbrowser : public QMainWindow {
+ Q_OBJECT
+public:
+ static QString appName() { return QString::fromLatin1("gutenbrowser"); }
+#ifdef NOQUICKLAUNCH
+ Gutenbrowser();
+#else
+ Gutenbrowser(QWidget *p = 0, const char* name = 0, WFlags fl = 0);
+#endif
+ ~Gutenbrowser();
+ LibraryDialog* LibraryDlg;
+ QButton* InfoBar;
+ QFile newindexLib, indexLib;
+ QListBox *mainList;
+ QPrinter *printer;
+ QString brow;
+ QString file_name;
+ QString fontStr, pointSizeStr, weightStr, italicStr, boldStr;
+ QString ftp_base_dir;
+ QString ftp_host;
+ QString iniFile;
+ QString listItemFile;
+ QString listItemNumber;
+ QString listItemTitle;
+ QString listItemYear;
+ QString local_index;
+ QString local_library;
+ QString networkUrl;
+ QString pattern;
+ QString prefBrowser;
+ QString s_Wrap;
+ QString status;
+ QString statusTop;
+ QString title;
+ QPushButton *DownloadButton, *LibraryButton, *OpenButton, *ForwardButton, *BackButton, *PrintButton, *SearchButton, *dictionaryButton, *beginButton, *ExitButton, *OptionsButton, *FontButton, *ClearButton, *HelpButton, *setBookmarkButton;
+ MenuButton* lastBmkButton;
+ SearchDialog* searchDlg;
+
+ bool buttonsHidden;
+ bool italic, bold;
+ bool loadCheck;
+ bool useSplitter;
+ char host[1024];
+ char login[1024];
+ char password[1024];
+ int check;
+ int direction;
+ int i_pageNum;
+ int lastScrollRow;
+ int lineCheck;
+ int pages;
+ int pointSize, weight;
+// int styleI;
+
+public slots:
+
+private:
+
+/* typedef QValueList<int> pageStop; */
+/* pageStop pageStopArray; */
+// QVector<int> pageStopArray;
+ QArray<int> pageStopArray;
+
+ MultiLine_Ex* Lview;
+ QBoxLayout *buttons2;
+ QBoxLayout *buttons;
+ QBoxLayout *edits;
+ QBoxLayout *menu;
+ QBoxLayout *topLayout;
+ QFile f;
+ QPEMenuBar* menubar;
+ QPopupMenu *fileMenu, *editMenu, *viewMenu, *DownloadMenu, *optionsMenu, *bookmarksMenu, *donateMenu, *helpMenu;
+ bool useWrap;
+ int fileHandle, currentFilePos, currentLine;
+ int last_search;
+
+ bool getTitle( const char *file);
+ bool setTitle();
+ int repeatSearch();
+ void Search();
+ void OnNetworkDialog( const QString &networkUrl,const QString & output);
+ void hideButtons();
+
+private slots:
+
+ bool load( const char *fileName );
+ bool setStatus();
+ void BeginBtn();
+ void TopBtn();
+ void cleanUp();
+ void doBeginBtn();
+ void goGetit(const QString &url, bool showMsg);
+ void infoGutenbrowser();
+ void listClickedSlot( QListBoxItem *);
+ void mainListPressed(int, QListBoxItem *, const QPoint &);
+ void menuEditTitle();
+ void search_slot();
+ void searchdone_slot();
+ void setDocument(const QString&);
+ void slotFilePrint();
+// void setStyle(int styleInt);
+
+
+protected:
+
+ bool UnZipIt(const QString &zipFile);
+ bool b_queryExit;
+ bool queryExit();
+ bool showMainList;
+ bool useIcons;
+ bool working;
+
+
+protected slots:
+
+ void BackBtn();
+ void Bookmark( int);
+ void ByeBye();
+ void ChangeFont();
+ void ClearEdit();
+ void DownloadIndex();
+ void ForwardBtn();
+ void HelpBtn();
+ void InfoBarClick();
+ void LibraryBtn();
+ void LookupBtn();
+ void OpenBtn();
+ void PrintBtn();
+ void SearchBtn();
+ void annotations();
+ void doOptions();
+ void donateByteMonkie();
+ void donateGutenberg();
+ void downloadFtpList();
+ void downloadLibIndex();
+ void enableButtons(bool);
+ void fillWithTitles();
+ void fixKeys();
+ void initButtonBar();
+ void initConfig();
+ void initMenuBar();
+ void initSlots();
+ void initStatusBar();
+ void initView();
+ void menuGoogle();
+ void menuOpen();
+ void searchGoogle(const QString &);
+ void setBookmark();
+ void toggleButtonIcons( bool usingIcons);
+// virtual void setBrowser();
+// void stylePlatinum();
+// void styleWindows();
+// void defaultStyle();
+/* void styleMotif(); */
+/* void styleMotifPlus(); */
+/* void styleWood(); */
+/* void stylePlatinumPlus(); */
+/* void styleCDE(); */
+// void styleMetal();
+/* void styleSgi(); */
+/* void styleLace(); */
+/* void styleLacePlus(); */
+/* #endif */
+protected:
+
+ int doSearch(const QString & s_pattern , bool case_sensitive, bool forward, int line, int col );
+ void focusInEvent( QFocusEvent* );
+ void focusOutEvent( QFocusEvent* );
+ void keyPressEvent( QKeyEvent * );
+ void keyReleaseEvent( QKeyEvent *e);
+ void resizeEvent( QResizeEvent * );
+ void writeConfig();
+// void moveSplitter( int pos);
+};
+#endif
+
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp
new file mode 100644
index 0000000..c9149ac
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp
@@ -0,0 +1,328 @@
+/***************************************************************************
+ gutenbrowser.cpp - description
+ -------------------
+ begin : Mon Jul 24 22:33:12 MDT 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+***************************************************************************/
+/***************************************************************************
+ * 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 "gutenbrowserData.h"
+#include "gutenbrowser.h"
+
+#include <qpe/config.h>
+#include <qpe/fontdatabase.h>
+#include <qpe/menubutton.h>
+#include <qpe/resource.h>
+#include <qpe/qpeapplication.h>
+
+#include <qfontinfo.h>
+#include <qtoolbutton.h>
+
+void Gutenbrowser::initSlots() {
+
+ connect(LibraryButton,SIGNAL(released()),SLOT(LibraryBtn()));
+ connect(OpenButton,SIGNAL(released()),SLOT(OpenBtn()));
+ connect(SearchButton,SIGNAL(released()),SLOT(SearchBtn()));
+ connect(ForwardButton,SIGNAL(clicked()),SLOT(ForwardBtn()));
+ connect(BackButton,SIGNAL(clicked()),SLOT(BackBtn()));
+ connect(setBookmarkButton,SIGNAL(released()),SLOT(setBookmark()));
+ connect(dictionaryButton,SIGNAL(released()),SLOT(LookupBtn()));
+ connect(InfoBar,SIGNAL(clicked()),SLOT(InfoBarClick()));
+ connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp()));
+ connect(mainList,SIGNAL(clicked(QListBoxItem *)),SLOT(listClickedSlot(QListBoxItem *)));
+ connect(bookmarksMenu,SIGNAL(activated(int)),SLOT(Bookmark(int)));
+}
+
+void Gutenbrowser::initConfig() {
+//qDebug("Starting configuration.");
+ QDir library(local_library);
+ if ( !library.exists()) {
+ library.mkdir(local_library, TRUE);
+ QString msg;
+// #ifndef Q_WS_WIN
+ msg = "chmod 755 " + local_library;
+ system(msg);
+// QDir pixdir(local_library+"pix");
+// if ( !pixdir.exists()) {
+// pixdir.mkdir(local_library+"pix", TRUE);
+// QString msg;
+// msg = "chmod 755 " + local_library+"pix";
+// system(msg);
+// }
+// #endif
+
+ }
+ // qDebug( "init file is %s",iniFile.latin1());
+
+#ifdef Q_WS_QWS
+ useSplitter=FALSE;
+ Config config("Gutenbrowser");
+
+ config.setGroup( "General" );
+//useWordWrap_CheckBox
+ useIcons=TRUE;
+#else
+
+ config.setGroup( "General" );
+ QString s_Split=config.readEntry("Splitter", "TRUE" );
+ QWidget *d = QApplication::desktop();
+ int width=d->width();
+ int height=d->height();
+ int w=0, h=0;
+ QString str, str2;
+
+ this->setMaximumWidth(width);
+
+ if(s_Split=="TRUE")
+ useSplitter=TRUE;
+ else
+ useSplitter=FALSE;
+
+ config.setGroup( "Geometry" );
+ if(width < 1030) {
+ str = config.readEntry("Frame", "700,500");
+ if( !str.isEmpty() && str.find(',')>=0) {
+ sscanf(str,"%d,%d",&w,&h);
+ resize(w,h);
+ str2.sprintf("%d,%d", (width-w)/2,(height-h)/2);
+ str = config.readEntry( "Position", str2);
+ } else {
+ resize( 740,510 );
+ str2.sprintf("%d,%d", (width-w)/2,(height-h)/2);
+ str = config.readEntry( "Position",str2);
+ }
+ } else {// desktop is high res
+ str = config.readEntry("Frame", "990,640");
+ if( !str.isEmpty() && str.find(',')>=0) {
+ sscanf(str,"%d,%d",&w,&h);
+ resize(w,h);
+ str2.sprintf("%d,%d", (width-w)/2,(height-h)/2);
+ str = config.readEntry( "Position", str2);
+ } else {
+ resize( 990,640 );
+ str2.sprintf("%d,%d", (width-w)/2,(height-h)/2);
+ str = config.readEntry( "Position", str2);
+ }
+ }
+ int posX, posY;
+ bool ok;
+ QString goober;
+ goober=str.left( str.find(",", 0, TRUE) );
+ posX=goober.toInt( &ok, 10);
+ goober=str.right( str.findRev(",", -1, TRUE) );
+ posY= goober.toInt( &ok, 10);
+// move( posX, posY);
+ str = config.readEntry("Icons", "TRUE");
+ if(str == "TRUE")
+ useIcons=TRUE;
+ else
+ useIcons=FALSE;
+#endif
+// #if defined(_WS_WIN_)
+// move( posX-4, posY-20);
+// #endif
+
+ config.setGroup( "Browser" );
+ brow = config.readEntry( "Preferred", "Opera");
+ config.setGroup( "FTPsite" ); // ftp server config
+ ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org");
+// ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) );
+ ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) );
+ ftp_host=ftp_host.stripWhiteSpace();
+
+ ftp_base_dir= config.readEntry("base", "/pub/gutenberg");
+
+ //bool ok2;
+ QString temp;
+ QString copying;
+ copying="";
+
+ config.setGroup("General");
+ QString qExit;
+ qExit=config.readEntry("queryExit","TRUE");
+ if(qExit=="TRUE") {
+ b_queryExit=TRUE;
+// qDebug("Please query before leaving the library.");
+ } else {
+// qDebug("Please DO NOT query before leaving the library.");
+ b_queryExit=FALSE;
+ }
+// bookmarks
+// config.setGroup("Titles");
+// QString tmpTitle=config.readEntry(file_name,"");
+
+
+}// end initConfig()
+
+void Gutenbrowser::initMenuBar()
+{
+// qDebug("Starting menu init.");
+ // menuBar entry fileMenu
+ menubar = new QPEMenuBar(this);
+
+ fileMenu=new QPopupMenu();
+ fileMenu->insertItem(Resource::loadPixmap("gutenbrowser/openbook"),
+ "Open Local Library...", this, SLOT( OpenBtn()) );
+// fileMenu->insertItem("Download FTPSite", this, SLOT( downloadFtpList()) );
+ fileMenu->insertItem( Resource::loadPixmap("home"),
+ "Download Library Index", this, SLOT( downloadLibIndex()) );
+ fileMenu->insertItem( Resource::loadPixmap("quit"),
+ "Quit Gutenbrowser...", this, SLOT( ByeBye()) );
+ // menuBar entry editMenu
+
+ editMenu=new QPopupMenu();
+
+ editMenu->insertItem(Resource::loadPixmap("up"), "Top",
+ this, SLOT(TopBtn()) );
+ editMenu->insertItem( Resource::loadPixmap("back"), "Beginning",
+ this, SLOT(doBeginBtn()) );
+ editMenu->insertItem( Resource::loadPixmap("gutenbrowser/search"), "Search",
+ this, SLOT(SearchBtn()) );
+
+ editMenu->insertItem("Clear", this, SLOT(ClearEdit()) );
+
+ optionsMenu= new QPopupMenu();
+ optionsMenu->insertItem( Resource::loadPixmap("gutenbrowser/configure"),
+ "Configure", this, SLOT(doOptions()) );
+
+ donateMenu = new QPopupMenu();
+// donateMenu->insertItem("Gutenberg", this, SLOT(donateGutenberg()) );
+ donateMenu->insertItem( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"),
+ "Gutenbrowser Developer", this, SLOT(infoGutenbrowser()) );
+
+ menubar->insertItem("File", fileMenu);
+ menubar->insertItem("Page", editMenu);
+ menubar->insertItem("Options", optionsMenu);
+// menubar->insertItem("More Info", donateMenu);
+
+ menu->addWidget( menubar,0);
+
+ topLayout->addLayout( menu, 0);
+}
+
+void Gutenbrowser::initButtonBar()
+{
+//qDebug("Starting buttonbar init.");
+
+ OpenButton = new QPushButton( this, "OpenButton" );
+ OpenButton->setFocusPolicy( QWidget::TabFocus );
+
+ LibraryButton = new QPushButton( this, "LibraryButton" );
+ LibraryButton->setFocusPolicy( QWidget::TabFocus );
+
+ BackButton = new QPushButton( this, "BackButton" );
+ BackButton->setFocusPolicy( QWidget::TabFocus );
+ BackButton->setAutoRepeat(TRUE);
+
+ ForwardButton = new QPushButton( this, "ForwardButton" );
+ ForwardButton->setFocusPolicy( QWidget::TabFocus );
+// ForwardButton->setAutoRepeat(TRUE);
+
+ SearchButton = new QPushButton( this, "SearchButton" );
+ SearchButton->setFocusPolicy( QWidget::TabFocus );
+
+ setBookmarkButton = new QPushButton( this, "setBookmark" );
+ setBookmarkButton->setFocusPolicy( QWidget::TabFocus );
+
+ lastBmkButton = new MenuButton( this, "lastBmkButton" );
+ lastBmkButton->setFocusPolicy( QWidget::TabFocus );
+
+ bookmarksMenu = new QPopupMenu();
+ bookmarksMenu->insertItem("Last Set", this, SLOT(Bookmark( int) ));
+
+ lastBmkButton->setPopup(bookmarksMenu);
+
+ dictionaryButton = new QPushButton( this, "dictionaryButton" );
+ dictionaryButton->setFocusPolicy( QWidget::TabFocus );
+
+ InfoBar = new QPushButton( this, "Info_Bar" );
+// qDebug("Infobar");
+// if(!useSplitter) {
+
+ buttonsHidden=FALSE;
+ buttons2->setSpacing(2);
+ buttons2->addWidget(OpenButton, 0, AlignCenter);
+ buttons2->addWidget(LibraryButton, 0, AlignCenter);
+ buttons2->addWidget(BackButton, 0, AlignCenter);
+ buttons2->addWidget(ForwardButton, 0, AlignCenter);
+ buttons2->addWidget(SearchButton, 0, AlignCenter);
+ buttons2->addWidget(setBookmarkButton, 0, AlignCenter);
+ buttons2->addWidget(lastBmkButton, 0, AlignCenter);
+ buttons2->addWidget(dictionaryButton, 0, AlignCenter);
+ buttons2->addWidget(InfoBar, 0, AlignCenter);
+
+ topLayout->setSpacing(0);
+ topLayout->addLayout( buttons2,0);
+
+}
+
+/* STATUSBAR*/
+void Gutenbrowser::initStatusBar()
+{
+// #ifndef Q_WS_QWS
+
+// statusBar = new QStatusBar( this, "Status Bar");
+// statusBar->message(IDS_STATUS_DEFAULT, 2000);
+// #endif
+}
+
+void Gutenbrowser::initView()
+{
+ // set the main widget here
+// QFont defaultFont( "charter", 10, 50, 0 );
+ Lview = new MultiLine_Ex(this);
+
+ Config cfg("Gutenbrowser");
+ cfg.setGroup("Font");
+
+ FontDatabase fdb;
+ QFont defaultFont=Lview->font();
+ QFontInfo fontInfo(defaultFont);
+
+ QString family = cfg.readEntry("Family", fontInfo.family());
+ QString style = cfg.readEntry("Style", fdb.styleString(defaultFont));
+ int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10);
+ QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) );
+
+ defaultFont = fdb.font(family,style,i_size,charSet);
+
+ QString italic=cfg.readEntry("Italic","FALSE");
+ if(italic=="TRUE") {
+ qDebug("Set Italic font");
+ defaultFont = fdb.font(family,"Regular",i_size,charSet); //workaround
+ defaultFont.setItalic(TRUE);
+ }
+
+ Lview->setFont( defaultFont);
+ update();
+
+ cfg.setGroup("General");
+
+ if( cfg.readBoolEntry("WordWrap", 1)) {
+ Lview->setWordWrap(QMultiLineEdit::WidgetWidth);
+ useWrap=true;
+ } else {
+ Lview->setWordWrap(QMultiLineEdit::NoWrap);
+ useWrap=false;
+ }
+ mainList = new QListBox(this,"mainlist");
+
+// QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold);
+ // mainList->showMaximized();
+// mainList->setGeometry(2,30,230,160);
+ Lview->setReadOnly( true);
+ edits->addWidget( Lview);
+ edits->addWidget(mainList);
+
+ if(!showMainList) {
+ Lview->setText( "\nThis is gutenbrowser for the Sharp Zaurus.\nMake your self at home, sit back, relax and read something great. ");
+ } else
+ Lview->hide();
+
+ topLayout->addLayout( edits, 0);
+}
diff --git a/noncore/apps/opie-gutenbrowser/helpme.cpp b/noncore/apps/opie-gutenbrowser/helpme.cpp
new file mode 100644
index 0000000..6a9b8c0
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/helpme.cpp
@@ -0,0 +1,122 @@
+/***************************************************************************
+ helpme.cpp - description
+ -------------------
+ begin : Tue Jul 25 2000
+ begin : Sat Dec 4 1999
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+ ***************************************************************************/
+/***************************************************************************
+ * *
+ * 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 <qpe/qcopenvelope_qws.h>
+#include <qpe/qpeapplication.h>
+
+#include "helpme.h"
+#include "helpwindow.h"
+
+#include <qprogressdialog.h>
+#include <qlayout.h>
+
+#include <sys/stat.h>
+#include <unistd.h>
+
+HelpMe::HelpMe(QWidget *parent, QString name ) : QDialog(parent,name)
+{
+ local_library = ( QDir::homeDirPath ())+"/Applications/gutenbrowser/";
+ setCaption(tr("Gutenbrowser About " VERSION));
+
+ QGridLayout *layout = new QGridLayout( this );
+ layout->setSpacing( 4 );
+ layout->setMargin( 4 );
+
+ Edit = new QMultiLineEdit(this, "");
+ Edit->setReadOnly(true);
+ Edit->append(tr("Based on gutenbook.pl, available from http://www.gutenbook.org"));
+ Edit->append(tr("Much appreciation to Lee Burgess,"));
+ Edit->append(tr("for the original idea and concept of gutenbook.\n"));
+ Edit->append(tr("A list of current Gutenberg ftp sites is at http://promo.net/pg/index.html\n"));
+ Edit->append(tr("For bug reports, comments or questions about Gutenbrowser, email"));
+ Edit->append(tr("ljp@llornkcor.com\n"));
+ Edit->append(tr("\nMade using Qt, Qt Embedded, and Qtopia, a cross platform development API\nhttp://www.trolltech.com\n\n"));
+ Edit->append(tr("Arnold's Laws of Documentation:"));
+ Edit->append(tr("(1) If it should exist, it doesn't."));
+ Edit->append(tr("(2) If it does exist, it's out of date."));
+ Edit->append(tr("(3) Only documentation for"));
+ Edit->append(tr("useless programs transcends the"));
+ Edit->append(tr("first two laws.\n"));
+ Edit->append(tr("Everything is temporary, anyway....\n :o)"));
+ Edit->setWordWrap(QMultiLineEdit::WidgetWidth);
+ QString pixDir;
+ pixDir=QPEApplication::qpeDir()+"/pics/";
+ QPushButton *help;
+ help = new QPushButton(this);
+ help->setPixmap( QPixmap( pixDir+"gutenbrowser/help.png"));
+ help->setText("Help");
+ connect( help,SIGNAL(clicked()),this,SLOT( help() ));
+
+/* QPushButton *ok;
+ ok = new QPushButton(this);
+ ok->setPixmap( QPixmap( pixDir+"/gutenbrowser/exit.png"));
+ ok->setText("ok");
+ connect(ok,SIGNAL(clicked()),this,SLOT(accept() ));
+*/
+ help->setFixedHeight(25);
+// ok->setFixedHeight(25);
+
+// layout->addMultiCellWidget( ok, 0, 0, 4, 4 );
+ layout->addMultiCellWidget( help, 0, 0, 4, 4 );
+ layout->addMultiCellWidget( Edit, 1, 1, 0, 4 );
+}
+
+HelpMe::~HelpMe()
+{
+//delete Edit;
+
+}
+
+void HelpMe::goToURL()
+{
+
+ url = "http://www.llornkcor.com/";
+ goGetit( url);
+}
+
+void HelpMe::goToURL2()
+{
+ url = "http://www.gutenberg.org";
+ goGetit( url);
+}
+
+void HelpMe::goToURL3()
+{
+ url = "http://www.gutenbook.org";
+ goGetit( url);
+}
+
+void HelpMe::goGetit( QString url)
+{
+ HelpWindow *help = new HelpWindow( url, ".", 0, "gutenbrowser");
+ help->setCaption("Qt Example - Helpviewer");
+ help->showMaximized();
+ help->show();
+}
+
+void HelpMe::help()
+{
+ QString msg ;
+ msg=QPEApplication::qpeDir()+"help/html/gutenbrowser-index.html"; // or where ever this ends up to be
+qDebug(msg);
+ QString url = "file://"+msg;
+ goGetit( url);
+
+// QCopEnvelope e("QPE/Application/helpbrowser", "setDocument(QString)" );
+// e << msg;
+
+// goGetit( msg);
+}
diff --git a/noncore/apps/opie-gutenbrowser/helpme.h b/noncore/apps/opie-gutenbrowser/helpme.h
new file mode 100644
index 0000000..f39ca2c
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/helpme.h
@@ -0,0 +1,60 @@
+/***************************************************************************
+ helpme.h - description
+ -------------------
+ begin : Sat Dec 4 1999
+ begin : Tue Jul 25 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+ ***************************************************************************/
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef HELPME_H
+#define HELPME_H
+
+#include "gutenbrowser.h"
+#include <qmultilineedit.h>
+//#include "CConfigFile.h"
+//#include <kprocess.h>
+//#include <kprogress.h>
+#include <qdialog.h>
+#include <qprogressdialog.h>
+#include <qwidget.h>
+
+
+/**
+ *@author llornkcor
+ */
+
+class HelpMe : public QDialog {
+ Q_OBJECT
+public:
+ HelpMe(QWidget *parent, QString name);
+ ~HelpMe();
+
+// KProgress *progressBar;
+ QString url;
+ QLabel *label;
+QLabel *QTlabel;
+// CConfigFile *config;
+ QString local_library;
+
+private slots:
+ void goToURL();
+ void goToURL2();
+ void goToURL3();
+ void help();
+ void goGetit( QString url);
+ private:
+ QMultiLineEdit* Edit;
+
+
+};
+
+#endif
diff --git a/noncore/apps/opie-gutenbrowser/helpwindow.cpp b/noncore/apps/opie-gutenbrowser/helpwindow.cpp
new file mode 100644
index 0000000..e86ca49
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/helpwindow.cpp
@@ -0,0 +1,326 @@
+/****************************************************************************
+** $Id$
+**
+** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+*****************************************************************************/
+
+#include "helpwindow.h"
+#include <qstatusbar.h>
+
+#include <qmenubar.h>
+#include <qtoolbar.h>
+#include <qtoolbutton.h>
+#include <qcombobox.h>
+
+#include <ctype.h>
+
+HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name )
+ : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL()
+{
+ QString local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
+// readHistory();
+// readBookmarks();
+
+ browser = new QTextBrowser( this );
+ QStringList Strlist;
+ Strlist.append( home_);
+ browser->mimeSourceFactory()->setFilePath( Strlist );
+
+ browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
+
+ connect(browser,SIGNAL(textChanged()),this,SLOT(textChanged()));
+
+ setCentralWidget( browser );
+
+ if ( !home_.isEmpty() )
+
+////////////////////////////////
+ browser->setSource( home_ );
+
+////////////////////////////////
+ connect( browser, SIGNAL( highlighted( const QString&) ),
+ statusBar(), SLOT( message( const QString&)) );
+
+// resize( 640,600 );
+#ifdef Q_WS_QWS
+ setGeometry( 0,0,236,280);
+#else
+ setGeometry( 10,30,520,420 );
+// resize(520,420);
+#endif
+
+ QPopupMenu* file = new QPopupMenu( this );
+// file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N );
+ file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O );
+// file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P );
+ file->insertSeparator();
+ file->insertItem( tr("&Close"), this, SLOT( close() ), ALT | Key_Q );
+// file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), ALT | Key_X );
+
+ // The same three icons are used twice each.
+////F FIXME
+ QString pixs=(QDir::homeDirPath ()) +"/Applications/gutenbrowser/pix/";
+ QIconSet icon_back( QPixmap(pixs+"back.png") );
+ QIconSet icon_forward( QPixmap(pixs+"forward.png") );
+ QIconSet icon_home( QPixmap(pixs+"home.png") );
+
+ QPopupMenu* go = new QPopupMenu( this );
+ backwardId = go->insertItem( icon_back, tr("&Backward"), browser, SLOT( backward() ), ALT | Key_Left );
+ forwardId = go->insertItem( icon_forward, tr("&Forward"), browser, SLOT( forward() ), ALT | Key_Right );
+ go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) );
+
+// QPopupMenu* help = new QPopupMenu( this );
+// help->insertItem( tr("&About ..."), this, SLOT( about() ) );
+// help->insertItem( tr("About &Qt ..."), this, SLOT( aboutQt() ) );
+
+
+ hist = new QPopupMenu( this );
+ QStringList::Iterator it = history.begin();
+ for ( ; it != history.end(); ++it )
+ mHistory[ hist->insertItem( *it ) ] = *it;
+ connect( hist, SIGNAL( activated( int ) ), this, SLOT( histChosen( int ) ) );
+
+ bookm = new QPopupMenu( this );
+ bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) );
+ bookm->insertSeparator();
+
+ QStringList::Iterator it2 = bookmarks.begin();
+ for ( ; it2 != bookmarks.end(); ++it2 )
+ mBookmarks[ bookm->insertItem( *it2 ) ] = *it2;
+ connect( bookm, SIGNAL( activated( int ) ),
+ this, SLOT( bookmChosen( int ) ) );
+
+ menuBar()->insertItem( tr("&File"), file );
+ menuBar()->insertItem( tr("&Go"), go );
+ menuBar()->insertItem( tr( "History" ), hist );
+ menuBar()->insertItem( tr( "Bookmarks" ), bookm );
+// menuBar()->insertSeparator();
+// menuBar()->insertItem( tr("&Help"), help );
+
+ menuBar()->setItemEnabled( forwardId, FALSE);
+ menuBar()->setItemEnabled( backwardId, FALSE);
+ connect( browser, SIGNAL( backwardAvailable( bool ) ), this, SLOT( setBackwardAvailable( bool ) ) );
+ connect( browser, SIGNAL( forwardAvailable( bool ) ), this, SLOT( setForwardAvailable( bool ) ) );
+
+
+ QToolBar* toolbar = new QToolBar( this );
+ addToolBar( toolbar, "Toolbar");
+ QToolButton* button;
+
+ button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar );
+ connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
+ button->setEnabled( FALSE );
+ button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar );
+ connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
+ button->setEnabled( FALSE );
+ button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar );
+
+ toolbar->addSeparator();
+
+ pathCombo = new QComboBox( TRUE, toolbar );
+ connect( pathCombo, SIGNAL( activated( const QString & ) ), this, SLOT( pathSelected( const QString & ) ) );
+ toolbar->setStretchableWidget( pathCombo );
+
+// pathCombo->setMaximumWidth(190);
+// setRightJustification( TRUE );
+// setDockEnabled( Left, FALSE );
+// setDockEnabled( Right, FALSE );
+
+ pathCombo->insertItem( home_ );
+
+ browser->setFocus();
+
+
+}
+
+
+void HelpWindow::setBackwardAvailable( bool b)
+{
+ menuBar()->setItemEnabled( backwardId, b);
+}
+
+void HelpWindow::setForwardAvailable( bool b)
+{
+ menuBar()->setItemEnabled( forwardId, b);
+}
+
+
+void HelpWindow::textChanged()
+{
+ if ( browser->documentTitle().isNull() ) {
+ setCaption( "Gutenbrowser - Helpviewer - " + browser->context() );
+ selectedURL = browser->context();
+ }
+ else {
+ setCaption( "Gutenbrowser - Helpviewer - " + browser->documentTitle() ) ;
+ selectedURL = browser->documentTitle();
+ }
+
+ if ( !selectedURL.isEmpty() && pathCombo ) {
+ bool exists = FALSE;
+ int i;
+ for ( i = 0; i < pathCombo->count(); ++i ) {
+ if ( pathCombo->text( i ) == selectedURL ) {
+ exists = TRUE;
+ break;
+ }
+ }
+ if ( !exists ) {
+ pathCombo->insertItem( selectedURL, 0 );
+ pathCombo->setCurrentItem( 0 );
+ mHistory[ hist->insertItem( selectedURL ) ] = selectedURL;
+ } else
+ pathCombo->setCurrentItem( i );
+ selectedURL = QString::null;
+ }
+}
+
+HelpWindow::~HelpWindow()
+{
+ history.clear();
+ QMap<int, QString>::Iterator it = mHistory.begin();
+ for ( ; it != mHistory.end(); ++it )
+ history.append( *it );
+
+ QFile f( QDir::currentDirPath() + "/.history" );
+ f.open( IO_WriteOnly );
+ QDataStream s( &f );
+ s << history;
+ f.close();
+
+ bookmarks.clear();
+ QMap<int, QString>::Iterator it2 = mBookmarks.begin();
+ for ( ; it2 != mBookmarks.end(); ++it2 )
+ bookmarks.append( *it2 );
+
+ QFile f2( QDir::currentDirPath() + "/.bookmarks" );
+ f2.open( IO_WriteOnly );
+ QDataStream s2( &f2 );
+ s2 << bookmarks;
+ f2.close();
+}
+
+// void HelpWindow::about()
+// {
+// QMessageBox::about( this, "Gutenbrowser", "<p>Thanks to Trolltech for this</p>" );
+// }
+
+// void HelpWindow::aboutQt()
+// {
+// QMessageBox::aboutQt( this, "QBrowser" );
+// }
+
+void HelpWindow::openFile()
+{
+#ifndef QT_NO_FILEDIALOG
+ QString fn = QFileDialog::getOpenFileName( QString::null, QString::null, this );
+ if ( !fn.isEmpty() )
+ browser->setSource( fn );
+#endif
+}
+
+void HelpWindow::newWindow()
+{
+ ( new HelpWindow(browser->source(), "qbrowser") )->show();
+}
+
+void HelpWindow::print()
+{
+#ifndef QT_NO_PRINTER
+ QPrinter printer;
+ printer.setFullPage(TRUE);
+ if ( printer.setup() ) {
+ QPainter p( &printer );
+ QPaintDeviceMetrics metrics(p.device());
+ int dpix = metrics.logicalDpiX();
+ int dpiy = metrics.logicalDpiY();
+ const int margin = 72; // pt
+ QRect body(margin*dpix/72, margin*dpiy/72,
+ metrics.width()-margin*dpix/72*2,
+ metrics.height()-margin*dpiy/72*2 );
+ QFont font("times", 10);
+ QSimpleRichText richText( browser->text(), font, browser->context(), browser->styleSheet(),
+ browser->mimeSourceFactory(), body.height() );
+ richText.setWidth( &p, body.width() );
+ QRect view( body );
+ int page = 1;
+ do {
+ p.setClipRect( body );
+ richText.draw( &p, body.left(), body.top(), view, colorGroup() );
+ p.setClipping( FALSE );
+ view.moveBy( 0, body.height() );
+ p.translate( 0 , -body.height() );
+ p.setFont( font );
+ p.drawText( view.right() - p.fontMetrics().width( QString::number(page) ),
+ view.bottom() + p.fontMetrics().ascent() + 5, QString::number(page) );
+ if ( view.top() >= richText.height() )
+ break;
+ printer.newPage();
+ page++;
+ } while (TRUE);
+ }
+#endif
+}
+
+void HelpWindow::pathSelected( const QString &_path )
+{
+ browser->setSource( _path );
+ QMap<int, QString>::Iterator it = mHistory.begin();
+ bool exists = FALSE;
+ for ( ; it != mHistory.end(); ++it ) {
+ if ( *it == _path ) {
+ exists = TRUE;
+ break;
+ }
+ }
+ if ( !exists )
+ mHistory[ hist->insertItem( _path ) ] = _path;
+}
+
+void HelpWindow::readHistory()
+{
+ if ( QFile::exists( QDir::currentDirPath() + "/.history" ) ) {
+ QFile f( QDir::currentDirPath() + "/.history" );
+ f.open( IO_ReadOnly );
+ QDataStream s( &f );
+ s >> history;
+ f.close();
+ while ( history.count() > 20 )
+ history.remove( history.begin() );
+ }
+}
+
+void HelpWindow::readBookmarks()
+{
+ if ( QFile::exists( QDir::currentDirPath() + "/.bookmarks" ) ) {
+ QFile f( QDir::currentDirPath() + "/.bookmarks" );
+ f.open( IO_ReadOnly );
+ QDataStream s( &f );
+ s >> bookmarks;
+ f.close();
+ }
+}
+
+void HelpWindow::histChosen( int i )
+{
+ if ( mHistory.contains( i ) )
+ browser->setSource( mHistory[ i ] );
+}
+
+void HelpWindow::bookmChosen( int i )
+{
+ if ( mBookmarks.contains( i ) )
+ browser->setSource( mBookmarks[ i ] );
+}
+
+void HelpWindow::addBookmark()
+{
+ mBookmarks[ bookm->insertItem( caption() ) ] = caption();
+}
+
diff --git a/noncore/apps/opie-gutenbrowser/helpwindow.h b/noncore/apps/opie-gutenbrowser/helpwindow.h
new file mode 100644
index 0000000..8b3821b
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/helpwindow.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+** $Id$
+**
+** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+*****************************************************************************/
+
+#ifndef HELPWINDOW_H
+#define HELPWINDOW_H
+
+#include <qmainwindow.h>
+#include <qtextbrowser.h>
+#include <qstringlist.h>
+#include <qmap.h>
+#include <qdir.h>
+#include <qevent.h>
+
+class QComboBox;
+class QPopupMenu;
+
+class HelpWindow : public QMainWindow
+{
+ Q_OBJECT
+public:
+ HelpWindow( const QString& home_, const QString& path, QWidget* parent = 0, const char *name=0 );
+ ~HelpWindow();
+
+private slots:
+ void setBackwardAvailable( bool );
+ void setForwardAvailable( bool );
+
+ void textChanged();
+// void about();
+// void aboutQt();
+ void openFile();
+ void newWindow();
+ void print();
+
+ void pathSelected( const QString & );
+ void histChosen( int );
+ void bookmChosen( int );
+ void addBookmark();
+private:
+ void readHistory();
+ void readBookmarks();
+
+ QTextBrowser* browser;
+ QComboBox *pathCombo;
+ int backwardId, forwardId;
+ QString selectedURL;
+ QStringList history, bookmarks;
+ QMap<int, QString> mHistory, mBookmarks;
+ QPopupMenu *hist, *bookm;
+
+};
+
+
+
+
+
+#endif
+
diff --git a/noncore/apps/opie-gutenbrowser/main.cpp b/noncore/apps/opie-gutenbrowser/main.cpp
new file mode 100644
index 0000000..5c3348c
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/main.cpp
@@ -0,0 +1,64 @@
+
+/***************************************************************************
+ main.cpp - description
+ -------------------
+ begin : Mon Jul 24 22:33:12 MDT 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+ * 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 <opie2/oapplicationfactory.h>
+
+using namespace Opie::Core;
+
+OPIE_EXPORT_APP( OApplicationFactory<Gutenbrowser> )
+
+// #ifdef QT_QWS_NONOPIE
+
+// #include <qpe/qpeapplication.h>
+// #include "gutenbrowser.h"
+// #include <qstring.h>
+// // #include <stdio.h>
+// // #include <stdlib.h>
+
+// int main(int argc, char *argv[]){
+// QPEApplication a(argc, argv);
+// // char * psz;
+// // if (argc > 1) {
+// // for( int i=0; i < argc; i++) {
+// // psz = argv[i];
+// // if( psz[0] == '-' || psz[0] == '/' ) {
+// // // The next character is the option.
+// // switch( psz[1] )
+// // {
+// // case 'v': // help
+// // printf("Gutenbrowser: "VERSION"\n");
+// // // qDebug("Gutenbrowser: "VERSION);
+// // // return 0;
+// // break;
+// // case 't': // current time 19:34:20 04/03/00
+// // // return 0;
+// // break;
+// // case 'f': //
+// // // file_Name=argv[i+1];
+// // break;
+// // }
+// // }
+// // }
+// // }
+// // QNetworkProtocol::registerNetworkProtocol("http", new QNetworkProtocolFactory<Http>);
+// // qInitNetworkProtocols();//registers ftp protocol // for now
+// Gutenbrowser *gutenbrowser=new Gutenbrowser();
+// // a.setMainWidget(gutenbrowser);
+// a.showMainWidget(gutenbrowser,TRUE);
+// gutenbrowser->showMaximized();
+// gutenbrowser->show();
+// return a.exec();
+// }
+
+
+// #endif
diff --git a/noncore/apps/opie-gutenbrowser/multiline_ex.cpp b/noncore/apps/opie-gutenbrowser/multiline_ex.cpp
new file mode 100644
index 0000000..16ddd67
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/multiline_ex.cpp
@@ -0,0 +1,133 @@
+/***************************************************************************
+ multiline_ex.cpp - description
+ -------------------
+ begin : Fri Aug 25 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 <qmultilineedit.h>
+#include "multiline_ex.h"
+
+struct MultiLine_ExData
+//class MultiLine_ExData
+{
+public:
+ QColorGroup mypapcolgrp;
+ QColorGroup papcolgrp;
+ uint ownpalette : 1;
+};
+
+
+MultiLine_Ex::MultiLine_Ex( QWidget *parent , const char *name )
+ :QMultiLineEdit( parent,name )
+{
+
+#ifndef Q_WS_QWS
+// clearTableFlags( Tbl_autoHScrollBar | Tbl_autoVScrollBar); //for pre release testing
+#else
+// clearTableFlags( Tbl_autoVScrollBar ); //for pre release testing
+#endif
+// clearTableFlags( Tbl_autoHScrollBar | Tbl_autoVScrollBar); // for release
+// init();
+}
+
+void MultiLine_Ex::pageDown( bool mark )
+{
+ QMultiLineEdit::pageDown( mark );
+}
+
+void MultiLine_Ex::pageUp( bool mark )
+{
+ QMultiLineEdit::pageUp( mark );
+}
+
+
+void MultiLine_Ex::cursorLeft( bool mark, bool wrap )
+{
+ QMultiLineEdit::cursorLeft( mark, wrap );
+}
+
+void MultiLine_Ex::cursorRight( bool mark, bool wrap )
+{
+ QMultiLineEdit::cursorRight( mark, wrap );
+}
+
+void MultiLine_Ex::cursorUp( bool mark )
+{
+ QMultiLineEdit::cursorUp( mark );
+}
+
+void MultiLine_Ex::cursorDown( bool mark )
+{
+ QMultiLineEdit::cursorDown( mark );
+}
+
+
+//void MultiLine_Ex::setPaper( const QBrush& pap)
+//{
+
+//}
+
+int MultiLine_Ex::lastRow()
+{
+ return lastRowVisible();
+}
+
+int MultiLine_Ex::topRow()
+{
+ return topCell();
+}
+
+int MultiLine_Ex::editSize( )
+{
+ return viewHeight() / cellHeight();
+//scroll( 0, int yPixels );
+}
+
+void MultiLine_Ex::ScrollUp( int lines )
+{
+ for( int i = 0; i < lines; i++) {
+ this->setTopCell( topCell() + 1 );
+ }
+}
+
+void MultiLine_Ex::ScrollDown( int lines )
+{
+ for( int i = 0; i < lines; i++) {
+ this->setTopCell( topCell() -1 );
+ }
+}
+
+int MultiLine_Ex::lineHeight( int row)
+{
+ return this->cellHeight(row );
+}
+
+int MultiLine_Ex::Top( )
+{
+ return this->topCell();
+}
+
+int MultiLine_Ex::Rows( )
+{
+ return findRow ( 1 );
+}
+
+int MultiLine_Ex::PageSize()
+{
+ return viewHeight() / cellHeight() ;
+}
+
+bool MultiLine_Ex::hasSelectedText()
+{
+ return QMultiLineEdit::hasMarkedText();
+}
diff --git a/noncore/apps/opie-gutenbrowser/multiline_ex.h b/noncore/apps/opie-gutenbrowser/multiline_ex.h
new file mode 100644
index 0000000..5ef9c40
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/multiline_ex.h
@@ -0,0 +1,108 @@
+/**********************************************************************
+** $Id$
+**
+** Definition of MultiLine_Ex widget class
+** Copyright (C) 1992-1999 Troll Tech AS. All rights reserved.
+**
+** See the file LICENSE included in the distribution for the usage
+** and distribution terms, or http://www.troll.no/free-license.html.
+**
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+*****************************************************************************/
+
+#ifndef MULTILINE_EX_H
+#define MULTILINE_EX_H
+
+#ifndef QT_H
+#include <qlist.h>
+#include <qstring.h>
+#include <qtableview.h>
+//#include <qtable.h>
+
+#include <qmultilineedit.h>
+#endif // QT_H
+
+struct MultiLine_ExData;
+//class MultiLine_ExData;
+
+class/* Q_EXPORT*/ MultiLine_Ex : public QMultiLineEdit
+{
+ Q_OBJECT
+public:
+ MultiLine_Ex( QWidget *parent=0, const char *name=0 );//:
+// QMultiLineEdit(QWidget *parent=0, QString& name=0 );
+ // ~MultiLine_Ex();
+
+// const char *textLine( int line ) const;
+// QString text() const;
+//int row;
+// int numLines() const;
+//
+// bool isReadOnly() const;
+// bool isOverwriteMode() const;
+//
+// void setFont( const QFont &font );
+// void insertLine( const char *s, int line = -1 );
+// void insertAt( const char *s, int line, int col );
+// void removeLine( int line );
+//
+// void cursorPosition( int *line, int *col ) const;
+// void setCursorPosition( int line, int col, bool mark = FALSE );
+// void getCursorPosition( int *line, int *col );
+// bool atBeginning() const;
+// bool atEnd() const;
+//
+// bool autoUpdate() const;
+// void setAutoUpdate( bool );
+//
+// void setFixedVisibleLines( int lines );
+public:
+int row;
+//setPaper( QBrush& pap);
+ bool hasSelectedText();
+ void pageUp( bool mark=FALSE );
+ void pageDown( bool mark=FALSE );
+ void cursorLeft( bool mark=FALSE, bool wrap = TRUE );
+ void cursorRight( bool mark=FALSE, bool wrap = TRUE );
+ void cursorUp( bool mark=FALSE );
+ void cursorDown( bool mark=FALSE );
+ int lastRow();
+ int topRow();
+ int editSize( );
+ int pageSize ;
+ int maxLineWidth() const;
+ void ScrollUp( int lines);
+ void ScrollDown( int lines);
+ int Rows();
+ int Top();
+ int lineHeight( int row );
+ int PageSize();
+public slots:
+// void clear();
+// void setText( const char * );
+// void append( const char * );
+// void deselect();
+// void selectAll();
+// void setReadOnly( bool );
+// void setOverwriteMode( bool );
+// void paste();
+// void copyText();
+// void cut();
+signals:
+// void textChanged();
+// void returnPressed();
+
+protected:
+protected:
+private slots:
+private:
+
+private: // Disabled copy constructor and operator=
+#if defined(Q_DISABLE_COPY)
+ MultiLine_Ex( const MultiLine_Ex & );
+ MultiLine_Ex &operator=( const MultiLine_Ex & );
+#endif
+};
+#endif
+
diff --git a/noncore/apps/opie-gutenbrowser/openetext.cpp b/noncore/apps/opie-gutenbrowser/openetext.cpp
new file mode 100644
index 0000000..40f35d6
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/openetext.cpp
@@ -0,0 +1,517 @@
+/***************************************************************************
+ openetext.cpp - description
+ begin : Sat Dec 4 1999
+ begin : Tue Jul 25 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+ ***************************************************************************/
+/***************************************************************************
+ * 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>
+#include <qpe/applnk.h>
+#include <qpe/qpeapplication.h>
+
+#include <stdlib.h>
+#include <qtextstream.h>
+#include <qpe/config.h>
+
+#include <opie/ofiledialog.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";
+ initDialog();
+ connect( QListBox_1, SIGNAL(selected ( int)),this, SLOT(select_title(int)) );
+
+ getTitles();
+}
+
+OpenEtext::~OpenEtext()
+{
+}
+
+void OpenEtext::getTitles()
+{
+ QListBox_1->clear();
+ Config config("Gutenbrowser");
+ config.setGroup( "Files" );
+ s_numofFiles = config.readEntry("NumberOfFiles", "0");
+ QLabel_1->setText( tr(
+ s_numofFiles+" etexts in your library."));
+ int i_numofFiles = s_numofFiles.toInt();
+ for (int i = 1; i <= i_numofFiles+1; i++) {
+ QString temp;
+ temp.setNum(i);
+ config.setGroup( "Files" );
+ QString ramble = config.readEntry(temp, "" );
+ config.setGroup( "Titles" );
+ title = config.readEntry(ramble, "");
+ if( !title.isEmpty()) {
+ QListBox_1->insertItem ( QPixmap( QPEApplication::qpeDir()+"pics/gutenbrowser/gutenbrowser_sm.png"), title, -1);
+ }
+ }
+}
+
+/*
+ opens selected title */
+void OpenEtext::OpenTitle()
+{
+ if( QListBox_1->currentItem() != -1)
+ select_title( QListBox_1->currentItem() );
+ else {
+ QString sMsg;
+ sMsg = "You must select an Etext to open";
+ QMessageBox::message( "Error",sMsg);
+ }
+}
+
+void OpenEtext::select_title(int index )
+{
+ OpenButton->setDown(TRUE);
+ QString temp;
+ temp.setNum( index + 1);
+ const char * title;
+ title = QListBox_1->text( index );
+ openFileTitle = title;
+ Config config("Gutenbrowser");
+ config.setGroup( "Files" );
+ file = config.readEntry(temp, "");
+ OpenEtext::accept();
+}
+
+/*
+ This function imports already existing etexts into the local library list*/
+void OpenEtext::open()
+{
+OpenFileButton->setDown(TRUE);
+ title = "";
+ QString currDir="";
+ QString filer;
+ QString name_file;
+ QString local ;
+ local = (QDir::homeDirPath () +"Applications/gutenbrowser");
+ QDir library( local);
+
+// fileBrowser *browseForFiles;
+// browseForFiles=new fileBrowser(this,"Browse for File", TRUE, 0, "guten/plain;text/plain");
+// // browseForFiles=new fileBrowser(this,"fileBrowser",TRUE,0, "*");
+// browseForFiles->setFileView( 0);
+// browseForFiles->showMaximized();
+// browseForFiles->exec();
+// QString selFile= browseForFiles->selectedFileName;
+// fileList=browseForFiles->fileList;
+ Config cfg("Gutenbrowser");
+ cfg. setGroup ( "View" );
+ QString dir = cfg.readEntry("LastOpenDirectory", QPEApplication::documentDir());
+ QMap<QString, QStringList> map;
+ map.insert(tr("All"), QStringList() );
+ QStringList text;
+ text << "text/*";
+ map.insert(tr("Text"), text );
+ text << "*";
+ map.insert(tr("All"), text );
+
+ QString str = OFileDialog::getOpenFileName( 2, dir , QString::null, map);
+
+ if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) {
+ filer = str;
+
+ qDebug("Open file: "+str);
+
+ // QStringList::ConstIterator f;
+// QString fileTemp;
+// 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" ) {
+ 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;
+
+ 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();
+ getTitles();
+ qDebug("Filename is "+fileName);
+ lnk.setFile(fileName); //sets File property
+ lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D
+ lnk.setExec(fileName);
+ lnk.setIcon("gutenbrowser/Gutenbrowser");
+ if(!lnk.writeLink())
+ qDebug("Writing doclink did not work");
+
+ } // end of for each file name....
+ OpenFileButton->setDown(FALSE);
+}
+
+/*
+find the title in the config file */
+bool OpenEtext::FindTitle( QString filename)
+{
+ Config config("Gutenbrowser");
+ 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");
+ 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));
+ title = title.stripWhiteSpace ();
+// qDebug("Found the title 1 and it is %s", title.latin1());
+// QListBox_1->insertItem ( title);
+ }
+ if( indexLine.find( target2, 0, TRUE) > -1 && !findCheck) {
+ findCheck = TRUE;
+ title = indexLine.mid( indexLine.find( target2, 0, TRUE ) + ( target2.length()) , indexLine.find("\r", 0, TRUE) );
+ title = title.left( title.find( "*",0, TRUE));
+ title = title.stripWhiteSpace ();
+// qDebug("Found the title 2 and it is %s", title.latin1());
+// QListBox_1->insertItem ( title);
+ }
+ if( indexLine.find( target3, 0, TRUE) > -1 && !findCheck) {
+ findCheck = TRUE;
+ title = indexLine.mid( indexLine.find( target3, 0, TRUE) + ( target3.length()) , indexLine.find("\r", 0, TRUE));
+ 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();
+
+ 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);
+ config.writeEntry(interger, filename);
+ config.setGroup( "Titles" );
+ for (int i = 1; i <= i_numofFiles; i++) { //find dup titles in config file
+ QString temp;
+ temp.setNum(i);
+ config.setGroup( "Files" );
+ QString ramble = config.readEntry(temp, "" );
+ config.setGroup( "Titles" );
+ QString title1 = config.readEntry(ramble, "");
+ if(title1==title)
+ title+="1";
+ i= i_numofFiles+1;
+ }
+ if(title.length()<3) {
+// qDebug("title is empty");
+ title="Unknown";
+ }
+ config.writeEntry( filename,title);
+ }
+ } else {
+ QString sMsg;
+ sMsg = "Error opening library file: "+filename;
+ printf( sMsg+"\n");
+ }
+ return true;
+}
+
+QString OpenEtext::titleFromLibrary( QString fileName)
+{
+ QFile indexLib( local_index);
+ QString target;
+ int find1 = fileName.findRev("/",-1,TRUE) + 1;
+ int find2 = fileName.findRev(".gtn",-1,TRUE) - find1;
+ if(find2==-1-find1)
+ int find2 = fileName.findRev(".etx",-1,TRUE) - find1;
+ else if(find2==-1-find1)
+ int find2 = fileName.findRev(".txt",-1,TRUE) - find1;
+
+ target = fileName.mid( find1, find2 );
+ QString checker = target.right(1);
+ bool ok;
+ checker.toInt( &ok,10);
+ if( ok) {
+ target = target.left( target.length()-1);
+ checker = target.right(1);
+ ok = FALSE;
+ checker.toInt( &ok,10);
+ if( ok) {
+ target = target.left( target.length()-1);
+ }
+ }
+ if ( indexLib.open( IO_ReadOnly) ) {
+ // file opened successfully
+ QTextStream indexStream( &indexLib );
+ QString indexLine;
+ bool findCheck = FALSE;
+ while ( !indexStream.atEnd() ) { // until end of file..
+ indexLine = indexStream.readLine();
+
+ if( indexLine.find( target,0,FALSE) > 0 ) {
+ findCheck = TRUE;
+ title = indexLine.mid( 9, 50);
+// title = indexLine.mid( 26, indexLine.length() );
+ title = title.stripWhiteSpace ();
+// qDebug("Finally Found the title and it is\n %s", title.latin1());
+// QListBox_1->insertItem ( title);
+ }
+ } //end while loop
+ }
+ else
+ qDebug("Error opening library index "+ local_index);
+ return title;
+}
+
+bool OpenEtext::checkConf()
+{
+ QString file = fileName;
+ Config config("Gutenbrowser");
+ config.setGroup( "Files" );
+ QString s_numofFiles = config.readEntry("NumberOfFiles", "0" );
+ int i_numofFiles = s_numofFiles.toInt();
+
+ for (int i = 1; i <= i_numofFiles; i++) {
+ QString temp;
+ temp.setNum(i);
+ config.setGroup( "Files");
+ QString ramble = config.readEntry(temp, "" );
+
+ if(ramble == file ) {
+ return true;
+ }
+ }
+ return false;
+}
+
+void OpenEtext::remove()
+{
+ title_text = QListBox_1->text( QListBox_1->currentItem() );
+ title_text=title_text.stripWhiteSpace();
+ QString msg ="<p>Do you really want to REMOVE\n" +title_text +"?\nThis will not delete the file.</P>";
+ switch( QMessageBox::information( this, (tr("Remove Etext")),
+ (tr(msg)),
+ (tr("&Yes")), (tr("&Cancel")), 0 )){
+ case 0: // Yes clicked,
+ removeSelection();
+ QListBox_1->clear();
+ getTitles();
+ break;
+ case 1: // Cancel
+ break;
+ };
+}
+
+/*
+ this removes selected title entry*/
+void OpenEtext::removeSelection()
+{
+ Config config("Gutenbrowser");
+ config.setGroup( "Files" );
+ s_numofFiles = config.readEntry("NumberOfFiles", "0");
+ int rem=0;
+ int i_numofFiles = s_numofFiles.toInt();
+ QString fileNum2;
+ QString fileNum;
+
+ for (int i = 1; i <= i_numofFiles; i++) {
+ fileNum.setNum(i);
+ config.setGroup( "Files" );
+
+ QString s_filename = config.readEntry(fileNum, "" );
+ config.setGroup( "Titles" );
+
+ QString file_title = config.readEntry( s_filename, "");
+ if(title_text == file_title) {
+ rem=i;
+//qDebug("file title to remove is "+file_title);
+ selFile = s_filename;
+ config.removeEntry( s_filename); //removes file=title
+ }
+ }
+ config.setGroup( "Files" );
+
+ for(int fg = rem; fg < i_numofFiles ; fg++ ) { //this rewrites Files number entry
+ fileNum.setNum(fg);
+ fileNum2.setNum( fg + 1);
+
+ QString s_filename2 = config.readEntry(fileNum2, "" );
+
+ if (!s_filename2.isEmpty()) {
+ config.writeEntry(fileNum, s_filename2 );
+ }
+ }
+ config.writeEntry("NumberOfFiles", i_numofFiles - 1 );
+ config.removeEntry(fileNum2);
+// remFile();
+}
+
+/*
+ removes file title name from list and config file*/
+void OpenEtext::remFile()
+{
+ Config config("Gutenbrowser");
+ config.setGroup( "Files" );
+ QString remFile;
+ s_numofFiles = config.readEntry("NumberOfFiles", "0");
+ int i_numofFiles = s_numofFiles.toInt();
+ for (int i = 1; i <= i_numofFiles; i++) {
+ QString fileNum;
+ fileNum.setNum(i);
+ QString s_filename = config.readEntry(fileNum, "" );
+
+ if( s_filename == selFile) {
+ config.removeEntry(selFile);
+
+ for(int fg = i_numofFiles - i; fg < i_numofFiles ; fg++ ) { //this rewrites Files number entry
+ QString fileNum2;
+ fileNum2.setNum( fg + 1);
+ QString s_filename2 = config.readEntry(fileNum2, "" );
+
+ if (!s_filename2.isEmpty()) {
+ config.writeEntry(fileNum, s_filename2 );
+ }
+ }
+ }
+ }
+ config.writeEntry("NumberOfFiles", i_numofFiles - 1 );
+ config.removeEntry(s_numofFiles);
+
+ QListBox_1->triggerUpdate(true);
+}
+
+/*
+sorts the list*/
+void OpenEtext::scan() {
+
+ QListBox_1->sort(TRUE);
+ QListBox_1->triggerUpdate(true);
+}
+
+void OpenEtext::editTitle() {
+
+ int currentItem=QListBox_1->currentItem();
+ QString title_text = QListBox_1->text( currentItem);
+//qDebug("Selected "+title_text);
+
+ Config config("Gutenbrowser");
+ config.setGroup( "Files" );
+ s_numofFiles = config.readEntry("NumberOfFiles", "0");
+ int i_numofFiles = s_numofFiles.toInt();
+ QString fileNum;
+ for (int i = 1; i <= i_numofFiles+1; i++) {
+
+ fileNum.setNum(i);
+ config.setGroup( "Files" );
+ QString s_filename = config.readEntry(fileNum, "" );
+ config.setGroup( "Titles" );
+ QString file_title = config.readEntry( s_filename, "");
+//qDebug("file_title is "+file_title);
+ if(title_text == file_title ) {
+ selFile = s_filename;
+//qDebug("Edit: "+ file_title );
+ i=i_numofFiles+1;
+ Edit_Title *titleEdit;
+ titleEdit = new Edit_Title(this,file_title ,TRUE);
+ if(titleEdit->exec() !=0) {
+//qDebug(titleEdit->newTitle);
+ config.writeEntry( s_filename, titleEdit->newTitle);
+ QListBox_1->removeItem(currentItem);
+ QListBox_1->insertItem ( QPixmap( QPEApplication::qpeDir()+"pics/gutenbrowser/gutenbrowser_sm.png"), titleEdit->newTitle, currentItem);
+ }
+ }
+ }
+
+// getTitles();
+ QListBox_1->triggerUpdate(true);
+}
+
diff --git a/noncore/apps/opie-gutenbrowser/openetext.h b/noncore/apps/opie-gutenbrowser/openetext.h
new file mode 100644
index 0000000..6db71c4
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/openetext.h
@@ -0,0 +1,82 @@
+/***************************************************************************
+ openetext.h - description
+ -------------------
+ begin : Tue Jul 25 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+ ***************************************************************************/
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef OPENETEXT_H
+#define OPENETEXT_H
+#include "gutenbrowser.h"
+#include <qdialog.h>
+#include <qstringlist.h>
+#ifndef Q_WS_QWS
+#include <qfiledialog.h>
+#endif
+//#include <fileselector.h>
+#include <qlabel.h>
+#include <qlistbox.h>
+#include <qpushbutton.h>
+#include <qstrlist.h>
+#include <qwidget.h>
+//#include "CConfigFile.h"
+
+/**
+ *@author llornkcor
+ */
+
+class OpenEtext : public QDialog {
+ Q_OBJECT
+public:
+ OpenEtext(QWidget *parent, QString name);
+ ~OpenEtext();
+
+ QPushButton* RemoveButton, * OpenFileButton, * OpenButton, *scanButton, *editButton;
+ void getTitles();
+ QString title;
+ QString file;
+ QString selFile;
+ QString s_numofFiles;
+ QString fileName;
+ QString name;
+ QString openFileTitle;
+ QStringList fileList;
+ QString local_library;
+ QString local_index;
+ QString title_text;
+ void remFile();
+ void removeSelection();
+ QString titleFromLibrary( const QString fileName);
+ bool FindTitle( const QString filename);
+ bool checkConf();
+// CConfigFile *config;
+
+protected:
+
+ void initDialog();
+ QListBox *QListBox_1;
+ QPushButton *QPushButton_OK;
+ QPushButton *QPushButton_Cancel;
+ QLabel *QLabel_1;
+
+private:
+private slots:
+
+ virtual void select_title(int index );
+ virtual void remove();
+ virtual void scan();
+ virtual void open();
+ virtual void OpenTitle();
+ virtual void editTitle();
+};
+
+#endif
diff --git a/noncore/apps/opie-gutenbrowser/openetextdata.cpp b/noncore/apps/opie-gutenbrowser/openetextdata.cpp
new file mode 100644
index 0000000..36b3e0e
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/openetextdata.cpp
@@ -0,0 +1,77 @@
+/***************************************************************************
+ openetextdata.cpp - description
+ -------------------
+ begin : Sat Dec 4 1999
+ begin : Tue Jul 25 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+ ***************************************************************************/
+/***************************************************************************
+ * *
+ * 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 "openetext.h"
+#include <qtooltip.h>
+#include <qlayout.h>
+#include <qpe/config.h>
+
+void OpenEtext::initDialog()
+{
+ this->setCaption("gutenbrowser local library");
+
+ QGridLayout *layout = new QGridLayout( this );
+ layout->setSpacing( 4 );
+ layout->setMargin( 4 );
+
+// local_index = local_library +"PGWHOLE.TXT";
+ local_index = local_library +"GUTINDEX.ALL";
+
+ QListBox_1= new QListBox(this,"ListBox");
+ QListBox_1->setAutoUpdate( TRUE );
+
+ OpenButton = new QPushButton( this, "OpenButton" );
+ OpenButton->setFocusPolicy( QWidget::TabFocus );
+ OpenButton->setText("&Open");
+ OpenFileButton = new QPushButton( this, "addButton" );
+ OpenFileButton->setText("&Import");
+
+ RemoveButton = new QPushButton( this, "removeButton" );
+ RemoveButton->setFocusPolicy( QWidget::TabFocus );
+ RemoveButton->setText("&Delete");
+
+ QPushButton * scanButton;
+ scanButton= new QPushButton( this, "scanButton" );
+ scanButton->setFocusPolicy( QWidget::TabFocus );
+
+ scanButton->setText("&Sort");
+ editButton= new QPushButton(this,"EditBtn");
+ editButton->setText("&Edit");
+
+ QLabel_1= new QLabel(this,"label");
+
+ layout->addMultiCellWidget( OpenButton, 0, 0, 0, 0 );
+ layout->addMultiCellWidget( OpenFileButton, 0, 0, 1, 1 );
+ layout->addMultiCellWidget( RemoveButton, 0, 0, 2, 2 );
+ layout->addMultiCellWidget( scanButton, 0, 0, 3, 3 );
+ layout->addMultiCellWidget( editButton, 0, 0, 5, 5 );
+
+ layout->addMultiCellWidget( QLabel_1, 1, 1, 0, 5 );
+ layout->addMultiCellWidget( QListBox_1, 2, 2, 0, 5 );
+
+ OpenButton->setFixedHeight(22);
+ OpenFileButton->setFixedHeight(22);
+ RemoveButton->setFixedHeight(22);
+ scanButton->setFixedHeight(22);
+ editButton->setFixedHeight(22);
+
+ connect( OpenButton, SIGNAL(released()), SLOT( OpenTitle()) );
+ connect( OpenFileButton, SIGNAL(released()), SLOT(open()) );
+ connect( RemoveButton, SIGNAL(released()), SLOT(remove()) );
+ connect( scanButton, SIGNAL(released()), SLOT( scan()) );
+ connect( editButton, SIGNAL(released()),SLOT(editTitle()));
+}
diff --git a/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.control b/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.control
new file mode 100644
index 0000000..b3a9157
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.control
@@ -0,0 +1,11 @@
+Package: opie-gutenbrowser
+Files: bin/gutenbrowser apps/Applications/gutenbrowser.desktop etc/gutenbrowser/* pics/gutenbrowser/*
+Priority: optional
+Section: opie
+Maintainer: ljp <lpotter@trolltech.com>
+Source: opie.handhelds.org
+Architecture: arm
+Version: $QPE_VERSION-$SUB_VERSION
+Depends: ftplib, libopie
+Description: Etext read for the Project Gutenberg.
+
diff --git a/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.pro b/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.pro
new file mode 100644
index 0000000..e34e922
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.pro
@@ -0,0 +1,45 @@
+TEMPLATE = app
+CONFIG += qt warn_on release quick-app
+#CONFIG += qt warn_on release qpp
+HEADERS = LibraryDialog.h \
+ SearchDialog.h \
+ SearchResults.h \
+ helpme.h \
+ multiline_ex.h \
+ openetext.h \
+ editTitle.h \
+ fontDialog.h \
+ optionsDialog.h \
+ helpwindow.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 \
+ gutenbrowser.cpp \
+ main.cpp
+TARGET = gutenbrowser
+
+INCLUDEPATH += $(OPIEDIR)/include
+DEPENDPATH += $(OPIEDIR)/include
+DESTDIR = $(OPIEDIR)/bin
+LIBS += -lqpe -lpthread -lftplib -lopie
+
+include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/opie-gutenbrowser/optionsDialog.cpp b/noncore/apps/opie-gutenbrowser/optionsDialog.cpp
new file mode 100644
index 0000000..bfd9c26
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/optionsDialog.cpp
@@ -0,0 +1,207 @@
+/***************************************************************************
+ optionsDialog.cpp - description
+ -------------------
+ begin : Tue Jul 25 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+ ***************************************************************************/
+/***************************************************************************
+ * *
+ * 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 "optionsDialog.h"
+#include <qpe/config.h>
+#include "fontDialog.h"
+
+// #include <unistd.h>
+// #include <stdio.h>
+// #include <stdlib.h>
+
+//#include "ftpsitedlg.h"
+//#include "browserDialog.h"
+//#define Inherited QDialog
+#include <qfont.h>
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qlabel.h>
+#include <qlistbox.h>
+#include <qpushbutton.h>
+#include <qtabwidget.h>
+#include <qwidget.h>
+#include <qlayout.h>
+#include <qvariant.h>
+#include <qtooltip.h>
+#ifndef Q_WS_QWS
+#include <qwhatsthis.h>
+#endif
+/*
+ * The dialog will by default be modeless, unless you set 'modal' to
+ * TRUE to construct a modal dialog.
+ */
+optionsDialog::optionsDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
+ : QDialog( parent, name, modal, fl )
+{
+ if ( !name )
+ setName( "optionsDialog" );
+ changedFonts=FALSE;
+ // styleChanged=FALSE;
+// connect( this,SIGNAL( aboutToQuit()),SLOT( OnExit()) );
+ b_qExit=TRUE;
+ initDialog();
+
+ ftpSiteDlg();
+ BrowserDlg();
+ FontDialog();
+}
+
+optionsDialog::~optionsDialog()
+{
+//qDebug("OnExit()");
+// writeConfig();
+}
+
+/// optionsDialog
+void optionsDialog::doOptions() {
+
+// config.read();
+ getConfig();
+}
+
+void optionsDialog::getConfig()
+{
+ Config config("Gutenbrowser");
+ config.setGroup( "FTPsite" ); // ftp server config
+ ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org");
+ ftp_base_dir= config.readEntry("base", "/pub/gutenberg");
+
+ TextLabel3->setText( "Current ftp server:\n"+ftp_host/* + ftp_base_dir */);
+
+ config.setGroup( "Proxy" ); // use ftp/http config
+ if( config.readEntry("IsChecked", "FALSE") == "TRUE") {
+ Ftp_CheckBox->setChecked( FALSE);
+ } else {
+ Ftp_CheckBox->setChecked( TRUE);
+ }
+
+ config.setGroup( "HttpServer" );
+ QString s_http = config.readEntry("Preferred", "http://sailor.gutenbook.org");
+ if( s_http == "http://sailor.gutenbook.org")
+ ComboBox1->setCurrentItem(0);
+ else
+ ComboBox1->setCurrentItem(1);
+
+ config.setGroup( "Browser" );
+ brow = config.readEntry("Preferred", "Opera");
+ browserName=brow;
+
+ TextLabel3_3->setText( "Current http browser:\n"+brow );
+
+ config.setGroup( "Geometry" );
+
+ // bool ok2;
+ QString temp;
+// config.setGroup( "StyleIze" );
+// temp = config.readEntry( "Style", "0");
+// int i_style=temp.toInt( &ok2,10);
+// #ifndef Q_WS_QWS
+
+// if( i_style==0){ styleInt=0; ComboBoxStyle->setCurrentItem(0);}//"styleMetal"));
+// if( i_style==1) { styleInt=1; ComboBoxStyle->setCurrentItem(1);}//"styleWindows") );
+// if( i_style==2) { styleInt=2; ComboBoxStyle->setCurrentItem(2);}//"stylePlatinum"));
+// if( i_style==2){ styleInt=2; ComboBoxStyle->setCurrentItem(2);}//"styleCDE") );
+// if( i_style==3) { styleInt=3; ComboBoxStyle->setCurrentItem(3);}//"styleMotif") );
+// if( i_style==4) { styleInt=4; ComboBoxStyle->setCurrentItem(4);}//"styleMotifPlus"));
+// // if( i_style==5) { styleInt=5; ComboBoxStyle->setCurrentItem(5);}//"styleWood") );
+// if( i_style==6) { styleInt=6; ComboBoxStyle->setCurrentItem(6);}//"styleSgi") );
+// if( i_style==7) { styleInt=7; ComboBoxStyle->setCurrentItem(7);}//"stylePlatinumPlus") );
+// if( i_style==9){ styleInt=9; ComboBoxStyle->setCurrentItem(9);}//"styleLace"));
+// if( i_style==10){ styleInt=10; ComboBoxStyle->setCurrentItem(10);}//"styleLacePlus"));
+// #endif
+ config.setGroup("General");
+ QString qExit=config.readEntry("queryExit","TRUE");
+ if(qExit=="TRUE") {
+ cb_queryExit->setChecked(TRUE);
+ qDebug("Config Setting b_qExit=TRUE;");
+ b_qExit=TRUE;
+ } else {
+ cb_queryExit->setChecked(FALSE);
+ qDebug("ConfigSetting b_qExit=FALSE;");
+ b_qExit=FALSE;
+ }
+
+
+ useWordWrap_CheckBox->setChecked( config.readBoolEntry("WordWrap", 1));
+ QString downDir=config.readEntry( "DownloadDirectory",local_library);
+ downloadDirEdit->setText(downDir);
+} // end getConfig
+
+// // void optionsDialog::setStyle( int index) {
+
+// // qDebug("Set style%d",index);
+// // //int styleInt= index;
+// // styleChanged=TRUE;
+// // if( ComboBoxStyle->currentItem()==0) styleInt=0;//"styleMetal"));
+// // if( ComboBoxStyle->currentItem()==1) styleInt=1;//"styleWindows") );
+// // if( ComboBoxStyle->currentItem()==2) styleInt=2;//"stylePlatinum"));
+// // // if( ComboBoxStyle->currentItem()==2) styleInt=2;//"styleCDE") );
+// // // if( ComboBoxStyle->currentItem()==3) styleInt=3;//"styleMotif") );
+// // // if( ComboBoxStyle->currentItem()==4) styleInt=4;//"styleMotifPlus"));
+// // // // if( ComboBoxStyle->currentItem()==5) styleInt=5;//"styleWood") );
+// // // if( ComboBoxStyle->currentItem()==6) styleInt=6;//"styleSgi") );
+// // // if( ComboBoxStyle->currentItem()==7) styleInt=7;//"stylePlatinumPlus") );
+// // // if( ComboBoxStyle->currentItem()==9) styleInt=9;//"styleLace"));
+// // // if( ComboBoxStyle->currentItem()==10) styleInt=10;//"styleLacePlus"));
+// // QString temp;
+// // temp.setNum(styleInt, 10);
+// // Config config("Gutenbrowser");
+// // config.setGroup( "StyleIze" );
+// // config.writeEntry( "Style", temp);
+// // config.write();
+// // }
+
+void optionsDialog::slotQueryExit()
+{
+ Config config("Gutenbrowser");
+ config.setGroup("General");
+ qDebug("writing queryExit");
+ if(cb_queryExit->isChecked()) {
+ b_qExit=TRUE;
+ config.writeEntry("queryExit","TRUE");
+ qDebug("WritingConfig queryExit=TRUE");
+ } else {
+ b_qExit=FALSE;
+ config.writeEntry("queryExit","FALSE");
+ qDebug("WritingConfig queryExit=FALSE");
+ }
+ config.write();
+}
+
+
+// void optionsDialog::slotUseSplit()
+// {
+
+// }
+
+// void optionsDialog::lineEditChanged(const QString &editText) {
+// qDebug(editText);
+// }
+
+void optionsDialog::changeFonts()
+{
+ changedFonts=TRUE;
+}
+
+
+void optionsDialog::slotWordWrap(bool b) {
+
+ Config config("Gutenbrowser");
+ config.setGroup("General");
+
+ config.writeEntry("WordWrap", b);
+ config.write();
+
+}
diff --git a/noncore/apps/opie-gutenbrowser/optionsDialog.h b/noncore/apps/opie-gutenbrowser/optionsDialog.h
new file mode 100644
index 0000000..091b169
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/optionsDialog.h
@@ -0,0 +1,112 @@
+/***************************************************************************
+ optionsDialog.h - description
+ -------------------
+ begin : Tue Jul 25 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+ * 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. *
+ * *
+ ***************************************************************************/
+#ifndef OPTIONSDIALOG_H
+#define OPTIONSDIALOG_H
+
+#include "gutenbrowser.h"
+#include "fontDialog.h"
+
+#include <qvariant.h>
+#include <qdialog.h>
+#include <qlineedit.h>
+#include <qpe/fontdatabase.h>
+#include <qfont.h>
+
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QCheckBox;
+class QComboBox;
+class QLabel;
+class QListBox;
+class QListBoxItem;
+class QPushButton;
+class QTabWidget;
+class QWidget;
+
+class optionsDialog : public QDialog
+{
+ Q_OBJECT
+
+ public:
+ optionsDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~optionsDialog();
+
+ QListBox* listBox,*http_ListBox1;
+ QPushButton* buttonOk, *fontChangeButton,*PushButton_Browse;
+ QTabWidget* tabWidget;
+ QWidget *tab, *Widget3, * Widget2, *fontWidget;
+ QCheckBox* Ftp_CheckBox,*Http_CheckBox;
+ QString s_Wrap;
+
+ QCheckBox* useWordWrap_CheckBox;
+ QCheckBox* cb_queryExit;
+ bool b_qExit;
+ QLabel* TextLabel2,*TextLabel3;
+ QListBox* ftp_QListBox_1;
+ QPushButton* ftp_DownloadButton;
+ QLabel* TextLabel3_3, *TextLabel4,*TextLabel5;
+ QComboBox *ComboBox1 ;///* * ComboBoxStyle,*/ ;
+ QLineEdit *downloadDirEdit;
+ bool changedFonts;
+ /////////////////////////////////////////////////////
+
+ void initDialog();
+ void initConnections();
+
+ // CConfigFile *config;
+ QString ftp_base_dir, ftp_host, brow, local_library;
+
+ // ftpsite
+ bool useIcon;
+ bool parseFtpList(QString outputFile);
+ QString ftpSite, ListFile, s_site, host, base_dir, browserName;
+// int styleInt;
+ // font dialog
+ FontDialog *fontDlg;
+
+// bool styleChanged;
+ protected:
+ void openSiteList();
+ void doOptions();
+ void ftpSiteDlg();
+ void BrowserDlg();
+ public slots:
+ void getConfig();
+ // void writeConfig();
+ // void iconCheckB();
+ void getSite();
+ void select_site( const char *index );
+ void getSelection( QListBoxItem *item);
+ // void lineEditChanged(const QString &);
+ private slots:
+ void slotWordWrap(bool);
+ void slotQueryExit();
+ void changeFonts();
+ protected slots:
+ // virtual void OnOK();
+ void listBoxMainSel( int index);
+// void setStyle( int index);
+ void setHttp(int);
+ // virtual void OptionsFtpClicked();
+ // virtual void httpCheckB();
+ // virtual void FtpCheckB();
+ // virtual void slotUseSplit();
+ // virtual void goBrowser(const QString&);
+ // virtual void chooseBrowser();
+ void select_title(int index);
+ void BrowseSelected();
+
+};
+
+#endif // OPTIONSDIALOG_H
diff --git a/noncore/apps/opie-gutenbrowser/optionsDialogData.cpp b/noncore/apps/opie-gutenbrowser/optionsDialogData.cpp
new file mode 100644
index 0000000..e03fa2c
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/optionsDialogData.cpp
@@ -0,0 +1,171 @@
+/***************************************************************************
+ optionsDialogData.cpp - description
+ -------------------
+ begin : Tue Jul 25 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+ ***************************************************************************/
+/***************************************************************************
+ * 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 <qpixmap.h>
+#include "optionsDialog.h"
+#include "fontDialog.h"
+
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qlineedit.h>
+#include <qcombobox.h>
+
+void optionsDialog::initDialog()
+{
+ QWidget *d = QApplication::desktop();
+ int width = d->width();
+ int height = d->height();
+
+ QGridLayout *layout = new QGridLayout( this );
+ layout->setSpacing(2);
+ layout->setMargin(2);
+
+ tabWidget = new QTabWidget( this, "tabWidget" );
+ layout->addMultiCellWidget( tabWidget, 0, 0, 0, 3);
+
+ Widget2 = new QWidget( tabWidget, "Widget2" );
+
+ QGridLayout *layout2 = new QGridLayout(Widget2 );
+ layout2->setSpacing(2);
+ layout2->setMargin(2);
+
+// Http_CheckBox = new QCheckBox( Widget2, "Http_CheckBox" );
+
+ QLabel *downLabel= new QLabel(Widget2,"Label1");
+ downLabel->setText("Download Directory:");
+ downLabel->setMaximumHeight(30);
+
+ downloadDirEdit = new QLineEdit(Widget2,"downloadDir");
+
+// ComboBoxStyle = new QComboBox( FALSE, Widget2, "ComboBoxStyle" );
+// ComboBoxStyle->insertItem( tr( "styleMetal") );
+// ComboBoxStyle->insertItem( tr( "styleWindows") );
+// ComboBoxStyle->insertItem( tr( "default style") );
+
+ cb_queryExit = new QCheckBox( Widget2, "cb_queryExit" );
+ cb_queryExit->setText("Query before exit.");
+
+ useWordWrap_CheckBox = new QCheckBox( Widget2, "WordWrap_CheckBox" );
+ useWordWrap_CheckBox->setText("Use Word Wrap");
+// Http_CheckBox->setText("Use pg index instead of ftp library index" ) ;
+ Ftp_CheckBox = new QCheckBox( Widget2, "Ftp_CheckBox" );
+ Ftp_CheckBox->setText("Use FTP");
+ Ftp_CheckBox->hide();
+
+ layout2->addMultiCellWidget( downLabel, 0, 0, 0, 2);
+// downloadDirEdit->setMaximumWidth( 200);
+ layout2->addMultiCellWidget( downloadDirEdit, 1, 1, 0, 0);
+ // layout2->addMultiCellWidget( ComboBoxStyle, 3, 3, 0, 0);
+ layout2->addMultiCellWidget( cb_queryExit, 2, 2, 0, 1);
+ layout2->addMultiCellWidget( useWordWrap_CheckBox, 3, 3, 0, 1);
+ QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ layout2->addItem( spacer, 4, 0 );
+// downloadDirEdit->hide();
+
+//////////////////////////////////////////////////////////
+ tabWidget->insertTab( Widget2, tr( "Main" ) );
+
+ Widget3 = new QWidget( tabWidget, "Widget3" );
+
+ QGridLayout *layout3 = new QGridLayout(Widget3 );
+ layout3->setSpacing(2);
+ layout3->setMargin(4);
+
+ TextLabel3 = new QLabel( Widget3, "TextLabel3" );
+ // TextLabel3->setProperty( "text", tr( "Current ftp server:/n" ) );
+ ftp_QListBox_1 = new QListBox( Widget3, "ftp_QListBox_1" );
+ ftp_DownloadButton = new QPushButton( Widget3, "ftp_DownloadButton" );
+
+//////////////////////////////////////////////////////////
+ tabWidget->insertTab( Widget3, tr( "FTP" ) );
+ tab = new QWidget( tabWidget, "tab" );
+
+ TextLabel3_3 = new QLabel( tab, "TextLabel3_3" );
+
+// TextLabel4 = new QLabel( tab, "TextLabel4" );
+// TextLabel5 = new QLabel( tab, "TextLabel5" );
+
+ PushButton_Browse = new QPushButton( tab, "PushButton_Browse" );
+
+ ComboBox1 = new QComboBox( FALSE, tab, "ComboBox1" );
+
+ ComboBox1->insertItem( tr( "http://sailor.gutenberg.org" ) );
+ ComboBox1->insertItem( tr( "http://www.prairienet.org/pg" ) );
+
+ http_ListBox1 = new QListBox( tab, "http_ListBox1" );
+
+//////////////////////////////////////////////////////////
+ tabWidget->insertTab( tab, tr( "HTTP" ) );
+
+ QGridLayout *layout4 = new QGridLayout(tab );
+ layout4->setSpacing(2);
+ layout4->setMargin(2);
+
+ fontDlg = new FontDialog( tabWidget,"FontDialog");
+// fontWidget= new QWidget( tabWidget, "fontWidget" );
+ tabWidget->insertTab( fontDlg,"Font");
+// fontDlg = new FontDialog( fontWidget,"FontDialog");
+// fontDlg->show();
+
+ initConnections();
+
+ ftp_DownloadButton->setText("New List");
+ PushButton_Browse->setText("Browse");
+
+ local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
+// config = new CConfigFile( local_library+"gutenbrowserrc");
+ doOptions();
+
+ layout3->addMultiCellWidget( ftp_DownloadButton, 0, 0, 1, 2);
+ layout3->addMultiCellWidget( TextLabel3, 1, 1, 0, 1);
+ layout3->addMultiCellWidget( ftp_QListBox_1, 2, 2, 0, 2);
+
+ TextLabel3_3->setMaximumHeight(50);
+ layout4->addMultiCellWidget( PushButton_Browse, 0, 0, 1, 2);
+ layout4->addMultiCellWidget( TextLabel3_3, 1, 1, 0, 1);
+ layout4->addMultiCellWidget( http_ListBox1, 2, 3, 0, 2);
+ layout4->addMultiCellWidget( ComboBox1, 4, 4, 0, 2);
+ setCaption(tr("Gutenbrowser Options"));
+}
+
+void optionsDialog::initConnections() {
+ // signals and slots connections
+// connect( buttonOk, SIGNAL( clicked() ), this, SLOT( OnExit() ) );
+// connect( fontChangeButton, SIGNAL( clicked() ), this, SLOT( changeFonts() ) );
+
+// connect( s_Browser, SIGNAL( activated(const QString&)), SLOT( goBrowser(const QString&) ) );
+// connect( Http_CheckBox, SIGNAL( clicked()), SLOT( httpCheckB()) );
+// connect( downloadDirEdit, SIGNAL(textChanged(const QString &)),SLOT( lineEditChanged(const QString &) ));
+
+// connect( Ftp_CheckBox, SIGNAL( clicked()), SLOT( FtpCheckB()) );
+// downloadLineEdit
+
+// ftpsiteDlg
+ connect( ftp_DownloadButton, SIGNAL( released() ),this, SLOT( getSite() ));
+ connect( ftp_QListBox_1, SIGNAL( clicked ( QListBoxItem *)),this, SLOT( getSelection( QListBoxItem *)) );
+
+//browserDialog
+ connect( http_ListBox1, SIGNAL(highlighted ( int)),this, SLOT(select_title(int)) );
+ connect( PushButton_Browse, SIGNAL( clicked() ), SLOT( BrowseSelected() ) );
+// connect( ComboBox1,SIGNAL(activated(int)),this,SLOT( setHttp(int)));
+
+// connect( tabWidget,SIGNAL(currentChanged(QWidget *tabber)),SLOT( onTab( QWidget * tabber)) );
+
+ connect(cb_queryExit,SIGNAL(clicked()),SLOT( slotQueryExit()) );
+ // connect(ComboBoxStyle,SIGNAL(activated(int)),this,SLOT(setStyle(int)));
+ connect( useWordWrap_CheckBox,SIGNAL( toggled(bool)),SLOT( slotWordWrap(bool)) );
+}
+
+void optionsDialog::listBoxMainSel( int index) {
+ tabWidget->setCurrentPage( index);
+}
diff --git a/noncore/apps/opie-gutenbrowser/output.cpp b/noncore/apps/opie-gutenbrowser/output.cpp
new file mode 100644
index 0000000..07a517f
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/output.cpp
@@ -0,0 +1,36 @@
+/****************************************************************************
+** outputEdit.cpp
+**
+** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com>
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+****************************************************************************/
+#include "output.h"
+
+#include <qmultilineedit.h>
+#include <qlayout.h>
+
+Output::Output( QWidget* parent, const char* name, bool modal, WFlags fl )
+ : QDialog( parent, name, modal, fl )
+{
+ if ( !name )
+ setName( "Output" );
+ resize( 196, 269 );
+ setCaption( name );
+ OutputLayout = new QGridLayout( this );
+ OutputLayout->setSpacing( 6 );
+ OutputLayout->setMargin( 11 );
+
+ OutputEdit = new QMultiLineEdit( this, "OutputEdit" );
+ OutputEdit->setWordWrap(QMultiLineEdit::WidgetWidth);
+ OutputLayout->addWidget( OutputEdit, 0, 0 );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+Output::~Output()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
diff --git a/noncore/apps/opie-gutenbrowser/output.h b/noncore/apps/opie-gutenbrowser/output.h
new file mode 100644
index 0000000..39c3eec
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/output.h
@@ -0,0 +1,30 @@
+/****************************************************************************
+** Form interface generated from reading ui file 'outputEdit.ui'
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+****************************************************************************/
+#ifndef OUTPUT_H
+#define OUTPUT_H
+
+#include <qvariant.h>
+#include <qdialog.h>
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QMultiLineEdit;
+
+class Output : public QDialog
+{
+ Q_OBJECT
+
+public:
+ Output( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~Output();
+
+ QMultiLineEdit* OutputEdit;
+
+protected:
+ QGridLayout* OutputLayout;
+};
+
+#endif // OUTPUT_H
diff --git a/noncore/apps/opie-gutenbrowser/resource.h b/noncore/apps/opie-gutenbrowser/resource.h
new file mode 100644
index 0000000..e335f85
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/resource.h
@@ -0,0 +1,73 @@
+/***************************************************************************
+ resource.h - description
+ -------------------
+ begin : Mon Jul 24 22:33:12 MDT 2000
+ copyright : (C) 2000 -2004 by llornkcor
+ email : ljp@llornkcor.com
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+#ifndef RESOURCE_H
+#define RESOURCE_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+//#define NO_DEBUG
+///////////////////////////////////////////////////////////////////
+// File-menu entries
+#define ID_FILE_NEW 10020
+#define ID_FILE_OPEN 10030
+
+#define ID_FILE_SAVE 10050
+#define ID_FILE_SAVE_AS 10060
+#define ID_FILE_CLOSE 10070
+
+#define ID_FILE_PRINT 10080
+
+#define ID_FILE_QUIT 10100
+
+
+///////////////////////////////////////////////////////////////////
+// Edit-menu entries
+#define ID_EDIT_UNDO 11010
+#define ID_EDIT_REDO 11020
+#define ID_EDIT_COPY 11030
+#define ID_EDIT_CUT 11040
+#define ID_EDIT_PASTE 11050
+#define ID_EDIT_SELECT_ALL 11060
+
+
+///////////////////////////////////////////////////////////////////
+// View-menu entries
+#define ID_VIEW_TOOLBAR 12010
+#define ID_VIEW_STATUSBAR 12020
+
+///////////////////////////////////////////////////////////////////
+// Help-menu entries
+#define ID_HELP_ABOUT 1002
+
+
+///////////////////////////////////////////////////////////////////
+// General application values
+#define VERSION "0.8.0"
+#define METAL 13030
+
+#if defined(_WS_X11_)
+#define IDS_APP_ABOUT "linuxgutenbrowser\n " VERSION "\n(w) 2001 -2004 by llornkcor"
+#endif
+#if defined(_WS_WIN_)
+#define IDS_APP_ABOUT "winuxgutenbrowser\n " VERSION "\n(w) 2001 -2004 by llornkcor"
+#endif
+//#define IDS_STATUS_DEFAULT "resistence is futile, prepare to be assimilated..."
+#define IDS_STATUS_DEFAULT ">>>=====> gutenbrowser <=====<<<"
+
+#endif // RESOURCE_H
diff --git a/noncore/apps/opie-gutenbrowser/unzip.readme b/noncore/apps/opie-gutenbrowser/unzip.readme
new file mode 100644
index 0000000..0fa23fc
--- a/dev/null
+++ b/noncore/apps/opie-gutenbrowser/unzip.readme
@@ -0,0 +1,4 @@
+Unzip sources can be had here.
+It is gpl'd.
+
+http://www.ctan.org/tex-archive/tools/zip/info-zip/UnZip.html