-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowser.cpp | 27 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp | 18 |
2 files changed, 25 insertions, 20 deletions
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp index 413ab51..e639d4d 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp +++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp @@ -8,54 +8,55 @@ * 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 <opie2/oresource.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> @@ -266,57 +267,57 @@ void Gutenbrowser::goGetit( const QString &url, bool showMsg) { } 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")); + 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(); @@ -1750,49 +1751,50 @@ void Gutenbrowser::enableButtons(bool 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); + mainList->insertItem ( Opie::Core::OResource::loadPixmap("gutenbrowser/gutenbrowser_sm", + Opie::Core::OResource::SmallIcon ), 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, ""); odebug << "About to load" << oendl; if( Lview->isVisible()) if(!load(file)) return; @@ -1899,49 +1901,50 @@ void Gutenbrowser::menuEditTitle() 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, ""); //odebug << "file_title is "+file_title << oendl; if(title_text == file_title ) { // selFile = s_filename; //odebug << "Edit: "+ file_title << oendl; i=i_numofFiles+1; Edit_Title *titleEdit; titleEdit = new Edit_Title(this,file_title ,TRUE); if(titleEdit->exec() !=0) { //odebug << titleEdit->newTitle << oendl; config.writeEntry( s_filename, titleEdit->newTitle); mainList->removeItem(currentItem); - mainList->insertItem ( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), titleEdit->newTitle, currentItem); + mainList->insertItem ( Opie::Core::OResource::loadPixmap("gutenbrowser/gutenbrowser_sm", + Opie::Core::OResource::SmallIcon ), titleEdit->newTitle, currentItem); } } } // getTitles(); mainList->triggerUpdate(true); } bool Gutenbrowser::UnZipIt(const QString &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); // } diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp index c93dbc5..d384c09 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp +++ b/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp @@ -1,44 +1,46 @@ /*************************************************************************** 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 "multiline_ex.h" /* OPIE */ #include <opie2/odebug.h> +#include <opie2/oresource.h> + #include <qpe/config.h> #include <qpe/fontdatabase.h> #include <qpe/menubutton.h> #include <qpe/resource.h> #include <qpe/qpeapplication.h> /* QT */ #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))); } @@ -150,75 +152,75 @@ void Gutenbrowser::initConfig() { config.setGroup("General"); QString qExit; qExit=config.readEntry("queryExit","TRUE"); if(qExit=="TRUE") { b_queryExit=TRUE; qDebug("lease 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"), + fileMenu->insertItem( Opie::Core::OResource::loadPixmap("gutenbrowser/openbook", Opie::Core::OResource::SmallIcon ), "Open Local Library...", this, SLOT( OpenBtn()) ); // fileMenu->insertItem("Download FTPSite", this, SLOT( downloadFtpList()) ); - fileMenu->insertItem( Resource::loadPixmap("home"), + fileMenu->insertItem( Opie::Core::OResource::loadPixmap("home", Opie::Core::OResource::SmallIcon ), "Download Library Index", this, SLOT( downloadLibIndex()) ); - fileMenu->insertItem( Resource::loadPixmap("quit"), + fileMenu->insertItem( Opie::Core::OResource::loadPixmap("quit", Opie::Core::OResource::SmallIcon ), "Quit Gutenbrowser...", this, SLOT( ByeBye()) ); // menuBar entry editMenu editMenu=new QPopupMenu(); - editMenu->insertItem(Resource::loadPixmap("up"), "Top", + editMenu->insertItem( Opie::Core::OResource::loadPixmap("up", Opie::Core::OResource::SmallIcon ), "Top", this, SLOT(TopBtn()) ); - editMenu->insertItem( Resource::loadPixmap("back"), "Beginning", + editMenu->insertItem( Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon ), "Beginning", this, SLOT(doBeginBtn()) ); - editMenu->insertItem( Resource::loadPixmap("gutenbrowser/search"), "Search", + editMenu->insertItem( Opie::Core::OResource::loadPixmap("gutenbrowser/search", Opie::Core::OResource::SmallIcon ), "Search", this, SLOT(SearchBtn()) ); editMenu->insertItem("Clear", this, SLOT(ClearEdit()) ); optionsMenu= new QPopupMenu(); - optionsMenu->insertItem( Resource::loadPixmap("gutenbrowser/configure"), + optionsMenu->insertItem( Opie::Core::OResource::loadPixmap("gutenbrowser/configure", Opie::Core::OResource::SmallIcon ), "Configure", this, SLOT(doOptions()) ); donateMenu = new QPopupMenu(); // donateMenu->insertItem("Gutenberg", this, SLOT(donateGutenberg()) ); - donateMenu->insertItem( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), + donateMenu->insertItem( Opie::Core::OResource::loadPixmap("gutenbrowser/gutenbrowser_sm", Opie::Core::OResource::SmallIcon ), "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); |