Diffstat (limited to 'noncore/apps/opie-gutenbrowser') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowser.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/helpme.cpp | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp index 020a116..3c096ed 100644 --- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp @@ -1,249 +1,249 @@ /*************************************************************************** // 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 "LibraryDialog.h" #include "output.h" /* OPIE */ #include <qpe/applnk.h> #include <qpe/qpeapplication.h> #include <qpe/qpedialog.h> #include <opie2/odebug.h> /* QT */ #include <qpushbutton.h> #include <qmultilineedit.h> //#include <qlayout.h> /* STD */ #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"; + iniFile = QPEApplication::qpeDir()+"etc/gutenbrowser/gutenbrowserrc"; - new_index =QPEApplication::qpeDir()+"/etc/gutenbrowser/PGWHOLE.TXT"; + new_index =QPEApplication::qpeDir()+"etc/gutenbrowser/PGWHOLE.TXT"; - old_index = QPEApplication::qpeDir()+"/etc/gutenbrowser/GUTINDEX.ALL"; + 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"); odebug << "Library Dialog: ftp_host is "+ftp_host << oendl; // 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); odebug << "downDir is "+downDir << oendl; newindexLib.setName( old_index); indexLib.setName( old_index); new QPEDialogListener(this); QTimer::singleShot( 1000, this, SLOT( FindLibrary()) ); } 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 //odebug << "Opening new library index " << newindexLib << "" << oendl; 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 // odebug << "Sorting last name first" << oendl; 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(); odebug << "opening GUTINDEX.ALL file" << oendl; 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)); //odebug << "file is "+file << oendl; /// 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(); //odebug << "title is "+title << oendl; getAuthor(); // grok author author = author.stripWhiteSpace(); //odebug << "author is "+author << oendl; 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")) || diff --git a/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp b/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp index a9c7346..de9c72b 100644 --- a/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp +++ b/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp @@ -1,233 +1,233 @@ /*************************************************************************** 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" /* OPIE */ #include <opie2/odebug.h> #include <qpe/config.h> /* QT */ #include <qprogressbar.h> #include <qurloperator.h> #include <qlistbox.h> /* STD */ #include <stdlib.h> #include <unistd.h> #include <stdio.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"; + ListFile = QPEApplication::qpeDir() + "etc/gutenbrowser"; QDir dir(ListFile); if( !dir.exists()) dir.mkdir(ListFile,true); ListFile+="/ftpList"; odebug << "opening "+ListFile << oendl; 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 // odebug << "gitcha!" << oendl; // } // delete NetworkDlg; //#ifdef Q_WS_QWS // TODO qprocess here QString cmd="wget -T 15 -O " +outputFile + " " + networkUrl + " 2>&1" ; odebug << "Issuing the command "+cmd << oendl; 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!! odebug << "parse ftplist "+outputFile << oendl; 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) { // odebug << "" << s << "" << oendl; end = s.find( ")", 0, TRUE)+1; s_location= s.mid( start+4, (end - start) ); // odebug << "" << s_location << "" << oendl; // 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() { odebug << " just opens the ftp site list" << oendl; // 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/ diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp index 644fae8..fac21da 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp +++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp @@ -1,342 +1,342 @@ /*************************************************************************** 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 "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" /* OPIE */ #include <opie2/odebug.h> #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> /* QT */ #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> /* STD */ #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(); qDebug("init finished"); 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) { odebug << tempTitle << oendl; if(!tempTitle.isEmpty()) bookmarksMenu->insertItem( tempTitle); } } // QString gutenIndex= local_library + "GUTINDEX.ALL"; - QString gutenIndex = QPEApplication::qpeDir()+ "/etc/gutenbrowser/GUTINDEX.ALL"; + QString gutenIndex = QPEApplication::qpeDir()+ "etc/gutenbrowser/GUTINDEX.ALL"; qDebug("gutenindex "+gutenIndex ); if( QFile( gutenIndex).exists() ) { indexLib.setName( gutenIndex); } else { - QString localLibIndexFile = QPEApplication::qpeDir()+ "/etc/gutenbrowser/PGWHOLE.TXT"; + QString localLibIndexFile = QPEApplication::qpeDir()+ "etc/gutenbrowser/PGWHOLE.TXT"; // QString localLibIndexFile= local_library + "PGWHOLE.TXT"; newindexLib.setName( localLibIndexFile); } qDebug("attempting new library"); 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"); if(!load(qApp->argv()[i])) return; } } else { fillWithTitles(); mainList->setFocus(); // mainList->setCurrentItem(0); } writeConfig(); QTimer::singleShot( 250, this, SLOT(hideView()) ); } //end init Gutenbrowser::~Gutenbrowser() { // QPEApplication::grabKeyboard(); // QPEApplication::ungrabKeyboard(); odebug << "Exit" << oendl; } /* 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/"; odebug << "filename "+filename << oendl; // 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"); odebug << "Preferred browser is "+brow << oendl; if(!showMsg) { //if we just get the gutenindex.all cmd="wget -O " + filename +" " + url+" 2>&1" ; chdir(local_library); odebug << "Issuing the system command: " << cmd << "" << oendl; 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"); odebug << "Issuing the command\n"+cmd << oendl; // 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); odebug << "Issuing the sys command: " << cmd << "" << oendl; system(cmd); } } void Gutenbrowser::toggleButtonIcons( bool useEm) { QString pixDir; if(useEm) useEm=TRUE; pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser"; odebug << "Docdir is "+QPEApplication::documentDir() << oendl; 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; diff --git a/noncore/apps/opie-gutenbrowser/helpme.cpp b/noncore/apps/opie-gutenbrowser/helpme.cpp index 53e0236..0e23114 100644 --- a/noncore/apps/opie-gutenbrowser/helpme.cpp +++ b/noncore/apps/opie-gutenbrowser/helpme.cpp @@ -1,127 +1,127 @@ /*************************************************************************** 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 "helpme.h" #include "helpwindow.h" /* OPIE */ #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> #include <opie2/odebug.h> /* QT */ #include <qprogressdialog.h> #include <qlayout.h> /* STD */ #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/"; + 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 odebug << msg << oendl; QString url = "file://"+msg; goGetit( url); // QCopEnvelope e("QPE/Application/helpbrowser", "setDocument(QString)" ); // e << msg; // goGetit( msg); } |