summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialog.cpp2
-rw-r--r--noncore/apps/opie-gutenbrowser/gutenbrowser.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
index 3b540c5..58babe9 100644
--- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
@@ -835,193 +835,193 @@ void LibraryDialog::sort()
}
/*
Downloads the current selected listitem*/
bool LibraryDialog::getItem(QListViewItem *it)
{
// //odebug << "selected getItem" << oendl;
// 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()
{
// //odebug << "selected onButtonDownloadz" << oendl;
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)
{
// //odebug << "we are sorting" << oendl;
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);
//odebug << "changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser" << oendl;
QString gutenindex1 = local_library + "/GUTINDEX.ALL";
- QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1";
+ QString cmd="wget -O " + gutenindex1 + " http://www.gutenberg.org/dirs/GUTINDEX.ALL 2>&1";
int result = QMessageBox::warning( this,"Download"
,"<p>Ok to use /'wget/' to download a new library list?</P>"
,"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 {
//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->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)
// //odebug << "renaming error" << oendl;
// }
}
// outDlg->close();
FindLibrary();
if(outDlg) delete outDlg;
}
buttonNewList->setDown(false);
// 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) {
//odebug << "Title is "+titleString << oendl;
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;
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
index e639d4d..733db17 100644
--- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
+++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
@@ -289,193 +289,193 @@ void Gutenbrowser::toggleButtonIcons( bool useEm) {
if( useIcons && QDir( pixDir).exists() ) {
LibraryButton->setPixmap( Opie::Core::OResource::loadPixmap("home", Opie::Core::OResource::SmallIcon ) );
OpenButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/openbook", Opie::Core::OResource::SmallIcon ));
ForwardButton->setPixmap( Opie::Core::OResource::loadPixmap("forward", Opie::Core::OResource::SmallIcon ));
BackButton->setPixmap( Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon ) );
SearchButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/search", Opie::Core::OResource::SmallIcon ) );
lastBmkButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/bookmark_folder", Opie::Core::OResource::SmallIcon ));
setBookmarkButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/bookmark", Opie::Core::OResource::SmallIcon ) );
dictionaryButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/spellcheck", Opie::Core::OResource::SmallIcon ) );
InfoBar->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/google", Opie::Core::OResource::SmallIcon ));
}
}
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.org/dirs/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) {
odebug << "loadCheck: we have a loaded doc" << oendl;
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);
// odebug << s << oendl;
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;
odebug << currentFilePos << " current page is number " << i_pageNum
<< ", pagesize " << pageSize << ", length " << Lview->length()
<< ", current " << pageStopArray[i_pageNum] << oendl;
setStatus();
// Lview->setCursorPosition( 0, 0, FALSE);
// }
} else {
odebug << "bal" << oendl;
// 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();
odebug << "page number " << i_pageNum << " line number " << currentLine << "" << oendl;
}
void Gutenbrowser::BackBtn() {
if( i_pageNum > 0) {
int pageSize= Lview->PageSize();
// int length=Lview->length();
i_pageNum--;
currentFilePos = f.at();
odebug << currentFilePos << " move back to " << pageStopArray[i_pageNum - 1 ]
<< ", current page number " << i_pageNum
<< ", " << pageSize << ", length " << Lview->length() << oendl;
if( i_pageNum < 2) {
f.at( 0);
} else {
if(!f.at( pageStopArray[i_pageNum - 1] ))
odebug << "File positioned backward did not work" << oendl;