summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-gutenbrowser/gutenbrowser.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/gutenbrowser.cpp153
1 files changed, 79 insertions, 74 deletions
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
index 2a9a71e..be2b897 100644
--- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
+++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
@@ -11,32 +11,36 @@
***************************************************************************/
// 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"
+/* 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>
@@ -48,12 +52,13 @@
#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>
@@ -128,13 +133,13 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags )
config.setGroup( "Titles" );
QString tempTitle = config.readEntry( ramble, "");
config.setGroup( tempTitle);
int index=config.readNumEntry( "LineNumber", -1 );
if( index != -1) {
- // qDebug( tempTitle);
+ // odebug << tempTitle << oendl;
bookmarksMenu->insertItem( tempTitle);
}
}
// QString gutenIndex= local_library + "GUTINDEX.ALL";
QString gutenIndex= QPEApplication::qpeDir()+ "/etc/gutenbrowser/GUTINDEX.ALL";
@@ -151,13 +156,13 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags )
chdir(local_library);
if(!showMainList) {
Lview->setFocus();
// if(firstTime)
// Bookmark();
for (int i=1;i< qApp->argc();i++) {
- qDebug("Suppose we open somethin");
+ odebug << "Suppose we open somethin" << oendl;
load(qApp->argv()[i]);
}
} else {
fillWithTitles();
mainList->setFocus();
// mainList->setCurrentItem(0);
@@ -166,13 +171,13 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags )
writeConfig();
} //end init
Gutenbrowser::~Gutenbrowser() {
// QPEApplication::grabKeyboard();
// QPEApplication::ungrabKeyboard();
- qDebug("Exit");
+ odebug << "Exit" << oendl;
}
/*
Google.com search */
void Gutenbrowser::InfoBarClick() {
QString text;
@@ -196,37 +201,37 @@ void Gutenbrowser::goGetit( const QString &url, bool showMsg) {
qApp->processEvents();
QString filename = QPEApplication::qpeDir();
if(filename.right(1)!="/")
filename+="/etc/gutenbrowser/";
else
filename+="etc/gutenbrowser/";
- qDebug("filename "+filename);
+ 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");
- qDebug("Preferred browser is "+brow);
+ 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);
- qDebug("Issuing the system command: %s", cmd.latin1());
+ 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");
- // qDebug("Issuing the command\n"+cmd);
+ // 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);
@@ -253,23 +258,23 @@ void Gutenbrowser::goGetit( const QString &url, bool showMsg) {
// 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());
+ 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";
- qDebug("Docdir is "+QPEApplication::documentDir());
+ 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
@@ -378,13 +383,13 @@ void Gutenbrowser::downloadLibIndex() {
void Gutenbrowser::PrintBtn() {
}
void Gutenbrowser::SearchBtn() {
if( loadCheck) {
- qDebug("loadCheck: we have a loaded doc");
+ odebug << "loadCheck: we have a loaded doc" << oendl;
Search();
}
// else
// QMessageBox::message("Note","Sorry, can't search. No etext is loaded");
}
@@ -401,13 +406,13 @@ void Gutenbrowser::ForwardBtn() {
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);
+ // odebug << s << oendl;
currentLine++;
}
// Lview->insertAt( insertString,0,0, FALSE);
currentFilePos = f.at();
// if( i_pageNum != pages) {
// Lview->MultiLine_Ex::pageDown( FALSE);
@@ -420,13 +425,13 @@ void Gutenbrowser::ForwardBtn() {
// currentFilePos, i_pageNum, pageSize, Lview->length(), pageStopArray[i_pageNum] );
setStatus();
Lview->setCursorPosition( 0, 0, FALSE);
// }
} else {
- // qDebug("bal");
+ // odebug << "bal" << oendl;
// if( i_pageNum != pages) {
// // int newTop = Lview->Top();
// // if(Lview->lastRow() > i)
// Lview->ScrollUp(1);
// // i_pageNum++;
@@ -435,13 +440,13 @@ void Gutenbrowser::ForwardBtn() {
// }
}
Lview->setFocus();
- // qDebug("page number %d line number %d", i_pageNum, currentLine);
+ // odebug << "page number " << i_pageNum << " line number " << currentLine << "" << oendl;
}
void Gutenbrowser::BackBtn() {
if( i_pageNum > 0) {
int pageSize= Lview->PageSize();
@@ -454,13 +459,13 @@ void Gutenbrowser::BackBtn() {
// 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");
+ odebug << "File positioned backward did not work" << oendl;
}
QString s;
// int sizeLine=0;
Lview->clear();
// QString insertString;
@@ -510,13 +515,13 @@ void Gutenbrowser::doBeginBtn() {
// moves text to the very top = 0
void Gutenbrowser::TopBtn() {
if(loadCheck) {
if( i_pageNum != 0) {
- qDebug("top");
+ odebug << "top" << oendl;
qApp->processEvents();
currentLine = 0;
i_pageNum = 1;
int pageSize = Lview->PageSize() ;
Lview->clear();
QString s;
@@ -568,17 +573,17 @@ void Gutenbrowser::BeginBtn() {
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);
+ // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl;
}
// 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);
+ odebug << "<<<<<< FOUND IT!! new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl;
break;
}
}
if(f.atEnd()) //in case we didnt find anything, we need to show something
f.at(0);
Lview->clear();
@@ -618,17 +623,17 @@ void Gutenbrowser::setBookmark() {
currentFilePos = f.at();
Config cfg("Gutenbrowser");
cfg.setGroup("General");
file_name=cfg.readEntry("Current","");
qApp->processEvents();
- qDebug("Settingbook mark "+file_name);
+ odebug << "Settingbook mark "+file_name << oendl;
cfg.setGroup("Titles");
title=cfg.readEntry(file_name,"");
- qDebug("title is "+ title);
+ odebug << "title is "+ title << oendl;
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]));
@@ -651,17 +656,17 @@ void Gutenbrowser::setBookmark() {
void Gutenbrowser::Bookmark( int itemId) {
// qApp->processEvents();
Config config("Gutenbrowser");
config.setGroup( "Bookmarks" );
- // qDebug("<<<<<< %d, %d", Lview->PageSize(), Lview->lastRow() - Lview->topRow() );
+ // odebug << "<<<<<< " << Lview->PageSize() << ", " << Lview->lastRow() - Lview->topRow() << "" << oendl;
QString itemString;
- qDebug("menu item %d", itemId);
+ odebug << "menu item " << itemId << "" << oendl;
QString tempTitle;
QString s_Bmrkrow;
QString s_pageNum;
int Bmrkrow=0;
int bookmarkPosition = 0;
@@ -697,13 +702,13 @@ void Gutenbrowser::Bookmark( int itemId) {
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);
+ // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl;
}
if(currentFilePos == bookmarkPosition)
break;
}
if(f.atEnd())
f.at(0);
@@ -726,28 +731,28 @@ void Gutenbrowser::Bookmark( int itemId) {
showMainList=FALSE;
mainList->hide();
Lview->show();
// qApp->processEvents();
}
- qDebug("bookmark loaded");
+ odebug << "bookmark loaded" << oendl;
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() );
+ // odebug << "Title is already set as "+title << oendl;
+ odebug << "sizeHint " << sizeHint().height() << " pageSize " << Lview->PageSize() << "" << oendl;
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);
+ odebug << "sizeHint " << sizeHint().height() << " point size " << pointSize << "" << oendl;
if(pointSize < 10)
Lview->setFixedVisibleLines(19);
else
Lview->setFixedVisibleLines( ( (sizeHint().height() / pointSize ) * 2) -2);
}
@@ -759,13 +764,13 @@ bool Gutenbrowser::load( const char *fileName) {
file_name=fileName;
QString o_file = fileName;
// if (i_pageNum < 1) {
i_pageNum = 1;
// }
- qDebug("ready to open "+o_file);
+ odebug << "ready to open "+o_file << oendl;
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)) );
@@ -795,20 +800,20 @@ bool Gutenbrowser::load( const char *fileName) {
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);
+ odebug << "Gulped " << currentLine << "" << oendl;
setCaption(title);
Lview->setAutoUpdate( TRUE);
Lview->setCursorPosition(0,0,FALSE);
// pages = (int)(( Lview->numLines() / Lview->editSize() ) / 2 ) +1;
- //qDebug("number of pages %d", pages);
+ //odebug << "number of pages " << pages << "" << oendl;
loadCheck = true;
enableButtons(true);
if( donateMenu->count() == 3) {
donateMenu->insertItem("Current Title", this, SLOT( InfoBarClick() ));
}
@@ -819,13 +824,13 @@ bool Gutenbrowser::load( const char *fileName) {
} // end load
void Gutenbrowser::Search() {
// if( searchDlg->isHidden())
{
- qDebug("Starting search dialog");
+ odebug << "Starting search dialog" << oendl;
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()));
@@ -955,15 +960,15 @@ int Gutenbrowser::doSearch( const QString &s_pattern , bool case_sensitive, boo
}
void Gutenbrowser::LibraryBtn() {
QString newestLibraryFile ="pgwhole.zip";
QString zipFile;
- // qDebug("Local Library is %s ", local_library.latin1());
+ // odebug << "Local Library is " << local_library << " " << oendl;
zipFile="/usr/bin/unzip";
- // qDebug("newestLibraryFile is %s ", newestLibraryFile.latin1());
+ // odebug << "newestLibraryFile is " << newestLibraryFile << " " << oendl;
if( QFile::exists( local_library+newestLibraryFile)) {
if( QFile::exists(zipFile) ) {
UnZipIt(newestLibraryFile);
}
else
QMessageBox::message( "Note",( tr("Please install unzip")) );
@@ -986,13 +991,13 @@ void Gutenbrowser::LibraryBtn() {
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);
+ // odebug << "title is being set as "+title << oendl;
title = listItemTitle;
// config.setGroup( "Proxy" );
// if( LibraryDlg->checked == 1) {
// config.writeEntry("IsChecked", "TRUE");
// } else {
@@ -1008,21 +1013,21 @@ void Gutenbrowser::LibraryBtn() {
// printf("\nFile name is now\n");
// printf(file_name);
// printf("\n");
//
if( file_name.find(".zip"))
{
- qDebug("Found zip file\n");
+ odebug << "Found zip file\n" << oendl;
// 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);
+ odebug << "Issuing the command "+ cmd << oendl;
// unzipProc=new QProcess( this, "unzipProc" ); /// fark that idea!
// unzipProc->start();
system(cmd);
remove( file_name);
}
@@ -1059,29 +1064,29 @@ void Gutenbrowser::OpenBtn() {
OpenEtext* OpenDlg;
OpenDlg = new OpenEtext(this,"OpenDlg");
OpenDlg->showMaximized();
if( OpenDlg->exec() != 0) {
title = OpenDlg->openFileTitle;
- qDebug("title open as "+title);
+ odebug << "title open as "+title << oendl;
file_name = OpenDlg->file;
i_pageNum = 1;
if( !file_name.isEmpty() || file_name.length() > 2 ) {
if(showMainList) {
showMainList=FALSE;
- qDebug("ShowMainList is now false");
+ odebug << "ShowMainList is now false" << oendl;
mainList->hide();
Lview->show();
qApp->processEvents();
}
Lview->clear();
// QCopEnvelope ( "QPE/System", "busy()" );
load(file_name);
} else {
- qDebug("file_name is empty!");
+ odebug << "file_name is empty!" << oendl;
if(showMainList) {
if(!Lview->isHidden())
Lview->hide();
qApp->processEvents();
if(mainList->isHidden())
mainList->show();
@@ -1241,13 +1246,13 @@ bool Gutenbrowser::getTitle( const char *file ) {
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);
+ // odebug << "(getTitle)title is being set as "+title << oendl;
}
}
return true;
}
void Gutenbrowser::searchdone_slot() {
@@ -1443,13 +1448,13 @@ void Gutenbrowser::keyPressEvent( QKeyEvent *e) {
// }
// break;
}
}
void Gutenbrowser::resizeEvent( QResizeEvent *ev) {
- // qDebug("resize: %d,%d\n",ev->size().width(),ev->size().height());
+ // odebug << "resize: " << ev->size().width() << "," << ev->size().height() << "\n" << oendl;
if( !LibraryDlg->isHidden())
LibraryDlg->resize(ev->size().width(),ev->size().height() );
// if( loadCheck == true) {
// ResizeEdits();
@@ -1473,13 +1478,13 @@ void Gutenbrowser::doOptions() {
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");
+ odebug << "writing library config" << oendl;
Config config("Gutenbrowser");
config.setGroup("General");
QString dirname= optDlg->downloadDirEdit->text();
if(dirname.right(1)!="/")
dirname+="/";
@@ -1490,13 +1495,13 @@ void Gutenbrowser::doOptions() {
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);
+ odebug << "Making new dir "+cmd << oendl;
if(Ddir.right(1)!="/") {
Ddir+="/";
}
config.writeEntry("DownloadDirectory",Ddir);
}
}
@@ -1506,23 +1511,23 @@ void Gutenbrowser::doOptions() {
if(optDlg->b_qExit==TRUE)
b_queryExit=TRUE;
else
b_queryExit=FALSE;
if(optDlg->fontDlg-> changedFonts) {
- qDebug("Setting font");
+ odebug << "Setting font" << oendl;
myFont=optDlg->fontDlg->selectedFont;
Lview->setFont( myFont);
}
if(optDlg->useWordWrap_CheckBox->isChecked() ) {
- qDebug("WORD WRAP is set");
+ odebug << "WORD WRAP is set" << oendl;
Lview->setWordWrap(QMultiLineEdit::WidgetWidth);
useWrap=true;
} else {
- qDebug("Word wrap is NOT set");
+ odebug << "Word wrap is NOT set" << oendl;
Lview->setWordWrap(QMultiLineEdit::NoWrap);
useWrap=false;
}
}
if(showMainList) {
if(!Lview->isHidden())
@@ -1575,14 +1580,14 @@ bool Gutenbrowser::setTitle() {
// config.write();
return true;
}
/*Calls new fangled network dialog */
void Gutenbrowser::OnNetworkDialog( const QString &/*networkUrl*/, const QString &/*output*/)
{
- // qDebug(networkUrl);
- // qDebug(output);
+ // odebug << networkUrl << oendl;
+ // odebug << output << oendl;
// #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 ) {
// }
@@ -1709,19 +1714,19 @@ void Gutenbrowser::focusOutEvent( QFocusEvent* )
void Gutenbrowser::cleanUp( )
{
writeConfig();
QPEApplication::grabKeyboard();
QPEApplication::ungrabKeyboard();
- // qDebug("Cleanup");
+ // odebug << "Cleanup" << oendl;
if(f.isOpen()) f.close();
}
void Gutenbrowser::fixKeys()
{
- qDebug("Attempting to fix keys");
+ odebug << "Attempting to fix keys" << oendl;
}
void Gutenbrowser::enableButtons(bool b)
{
BackButton->setEnabled(b);
@@ -1769,13 +1774,13 @@ void Gutenbrowser::listClickedSlot( QListBoxItem * index) {
QString temp;
temp.setNum( mainList->currentItem() + 1);
// openFileTitle = title;
Config config("Gutenbrowser");
config.setGroup( "Files" );
QString file = config.readEntry(temp, "");
- qDebug("About to load");
+ odebug << "About to load" << oendl;
if( Lview->isVisible())
load(file);
config.setGroup( title);
file_name = config.readEntry("File Name", "");
i_pageNum = config.readNumEntry("Page Number", 1);
@@ -1810,17 +1815,17 @@ void Gutenbrowser::setDocument(const QString & frozenBoogers) {
if(Lview->isHidden())
Lview->show();
qApp->processEvents();
}
DocLnk lnk;
lnk = DocLnk(frozenBoogers);
- // qDebug(lnk.file() );
+ // odebug << lnk.file() << oendl;
title=lnk.comment();
load( lnk.file());
this->show();
- // qDebug(title);
+ // odebug << title << oendl;
// qApp->processEvents();
// repaint();
}
void Gutenbrowser::mainListPressed(int mouse, QListBoxItem * , const QPoint & )
{
@@ -1870,13 +1875,13 @@ void Gutenbrowser::searchGoogle( const QString &tempText) {
}
void Gutenbrowser::menuEditTitle()
{
int currentItem = mainList->currentItem();
QString title_text = mainList->text( currentItem);
- //qDebug("Selected "+title_text);
+ //odebug << "Selected "+title_text << oendl;
Config config("Gutenbrowser");
config.setGroup( "Files" );
QString s_numofFiles = config.readEntry("NumberOfFiles", "0");
int i_numofFiles = s_numofFiles.toInt();
QString fileNum;
@@ -1884,21 +1889,21 @@ void Gutenbrowser::menuEditTitle()
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);
+ //odebug << "file_title is "+file_title << oendl;
if(title_text == file_title ) {
// selFile = s_filename;
- //qDebug("Edit: "+ file_title );
+ //odebug << "Edit: "+ file_title << oendl;
i=i_numofFiles+1;
Edit_Title *titleEdit;
titleEdit = new Edit_Title(this,file_title ,TRUE);
if(titleEdit->exec() !=0) {
- //qDebug(titleEdit->newTitle);
+ //odebug << titleEdit->newTitle << oendl;
config.writeEntry( s_filename, titleEdit->newTitle);
mainList->removeItem(currentItem);
mainList->insertItem ( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), titleEdit->newTitle, currentItem);
}
}
}
@@ -1908,73 +1913,73 @@ void Gutenbrowser::menuEditTitle()
}
bool Gutenbrowser::UnZipIt(const QString &zipFile) {
- qDebug(zipFile);
+ odebug << zipFile << oendl;
#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());
+ // odebug << (const char*)local_library.latin1() << oendl;
QString cmd;
#if defined(_WS_X11_)
if( chdir((const char*)local_library.latin1())!=0)
- qDebug("chdir failed.");
+ odebug << "chdir failed." << oendl;
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.");
+ odebug << "chdir failed." << oendl;
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);
+ odebug << "Issuing the command "+cmd << oendl;
system( cmd);
if( QFile::exists(thatFile))
remove (thatFile);
if(isPgWhole) {
if( rename("pgwhole","PGWHOLE.TXT") !=0)
- qDebug("rename failed");
+ odebug << "rename failed" << oendl;
} else {
if( rename(thatFile.left(4),thatFile.left(4)+".txt") !=0)
- qDebug("rename failed");
+ odebug << "rename failed" << oendl;
}
#endif
#ifdef Q_WS_QWS
- qDebug("Issuing the command "+cmd);
+ odebug << "Issuing the command "+cmd << oendl;
system( cmd);
if( QFile::exists(thatFile))
remove(thatFile);
if(isPgWhole) {
if( rename("pgwhole","PGWHOLE.TXT") !=0)
- qDebug("rename failed");
+ odebug << "rename failed" << oendl;
} else {
if( rename(thatFile.left(4),thatFile.left(4)+".txt") !=0)
- qDebug("rename failed");
+ odebug << "rename failed" << oendl;
}
#endif
// remove( zipFile);
return true;
}
else if(exit==QMessageBox::No) {
- // qDebug("unzip");
+ // odebug << "unzip" << oendl;
return false;
}
}
else
QMessageBox::message( "Note",( tr("Please install unzip in your PATH")) );
#endif