summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/gutenbrowser.cpp27
-rw-r--r--noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp18
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
@@ -1,101 +1,102 @@
1/*************************************************************************** 1/***************************************************************************
2 gutenbrowser.cpp - description 2 gutenbrowser.cpp - description
3 ------------------- 3 -------------------
4 begin : Mon Jul 24 22:33:12 MDT 2000 4 begin : Mon Jul 24 22:33:12 MDT 2000
5 copyright : (C) 2000 -2004 by llornkcor 5 copyright : (C) 2000 -2004 by llornkcor
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12// http search 12// http search
13// http://digital.library.upenn.edu/books/authors.html 13// http://digital.library.upenn.edu/books/authors.html
14// http://digital.library.upenn.edu/books/titles.html 14// http://digital.library.upenn.edu/books/titles.html
15// ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL 15// ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL
16// donate@gutenberg.net 16// donate@gutenberg.net
17 17
18 18
19#include "editTitle.h" 19#include "editTitle.h"
20#include "gutenbrowser.h" 20#include "gutenbrowser.h"
21#include "LibraryDialog.h" 21#include "LibraryDialog.h"
22 //#include "bookmarksdlg.h" 22 //#include "bookmarksdlg.h"
23#include "optionsDialog.h" 23#include "optionsDialog.h"
24#include "helpme.h" 24#include "helpme.h"
25#include "NetworkDialog.h" 25#include "NetworkDialog.h"
26 26
27#include "openetext.h" 27#include "openetext.h"
28#include "output.h" 28#include "output.h"
29 29
30/* OPIE */ 30/* OPIE */
31#include <opie2/odebug.h> 31#include <opie2/odebug.h>
32#include <opie2/oresource.h>
33
32#include <qpe/qpeapplication.h> 34#include <qpe/qpeapplication.h>
33#include <qpe/fontdatabase.h> 35#include <qpe/fontdatabase.h>
34#include <qpe/config.h> 36#include <qpe/config.h>
35#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
36#include <qpe/mimetype.h> 38#include <qpe/mimetype.h>
37#include <qpe/resource.h>
38#include <qpe/applnk.h> 39#include <qpe/applnk.h>
39 40
40/* QT */ 41/* QT */
41#include <qregexp.h> 42#include <qregexp.h>
42#include <qregion.h> 43#include <qregion.h>
43#include <qpaintdevicemetrics.h> 44#include <qpaintdevicemetrics.h>
44#include <qvaluelist.h> 45#include <qvaluelist.h>
45#include <qlabel.h> 46#include <qlabel.h>
46#include <qclipboard.h> 47#include <qclipboard.h>
47#include <qpainter.h> 48#include <qpainter.h>
48#include <qpalette.h> 49#include <qpalette.h>
49#include <qobjectlist.h> 50#include <qobjectlist.h>
50#include <qfontdialog.h> 51#include <qfontdialog.h>
51#include <qtextview.h> 52#include <qtextview.h>
52#include <qbrush.h> 53#include <qbrush.h>
53#include <qfile.h> 54#include <qfile.h>
54#include <qfontinfo.h> 55#include <qfontinfo.h>
55#include <qscrollview.h> 56#include <qscrollview.h>
56#include <qpoint.h> 57#include <qpoint.h>
57 58
58/* STD */ 59/* STD */
59#include <stdio.h> 60#include <stdio.h>
60#include <stdlib.h> 61#include <stdlib.h>
61#include <unistd.h> 62#include <unistd.h>
62#include <sys/stat.h> 63#include <sys/stat.h>
63#include <fcntl.h> 64#include <fcntl.h>
64#include <errno.h> 65#include <errno.h>
65 66
66static const int nfontsizes = 9; 67static const int nfontsizes = 9;
67static const int fontsize[nfontsizes] = {8,9,10,11,12,13,14,18,24}; 68static const int fontsize[nfontsizes] = {8,9,10,11,12,13,14,18,24};
68 69
69#ifdef NOQUICKLAUNCH 70#ifdef NOQUICKLAUNCH
70Gutenbrowser::Gutenbrowser() 71Gutenbrowser::Gutenbrowser()
71 Gutenbrowser(); 72 Gutenbrowser();
72#else 73#else
73Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags ) 74Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags )
74#endif 75#endif
75 : QMainWindow() 76 : QMainWindow()
76{ 77{
77 // QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 78 // QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
78 // QCopEnvelope e("QPE/System", "grabKeyboard(QString)" ); 79 // QCopEnvelope e("QPE/System", "grabKeyboard(QString)" );
79 // e << ""; 80 // e << "";
80 // QPEApplication::grabKeyboard(); 81 // QPEApplication::grabKeyboard();
81 showMainList=TRUE; 82 showMainList=TRUE;
82 working=false; 83 working=false;
83 this->setUpdatesEnabled(TRUE); 84 this->setUpdatesEnabled(TRUE);
84 // #ifndef Q_WS_QWS 85 // #ifndef Q_WS_QWS
85 QString msg; 86 QString msg;
86 msg="You have now entered unto gutenbrowser,\n"; 87 msg="You have now entered unto gutenbrowser,\n";
87 msg+="make your self at home, sit back, relax and read something great.\n"; 88 msg+="make your self at home, sit back, relax and read something great.\n";
88 89
89 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; 90 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
90 setCaption("Gutenbrowser");// Embedded " VERSION); 91 setCaption("Gutenbrowser");// Embedded " VERSION);
91 this->setUpdatesEnabled(TRUE); 92 this->setUpdatesEnabled(TRUE);
92 93
93 // bool firstTime=FALSE; 94 // bool firstTime=FALSE;
94 topLayout = new QVBoxLayout( this, 0, 0, "topLayout"); 95 topLayout = new QVBoxLayout( this, 0, 0, "topLayout");
95 96
96 menu = new QHBoxLayout(-1,"menu"); 97 menu = new QHBoxLayout(-1,"menu");
97 buttons2 = new QHBoxLayout(-1,"buttons2"); 98 buttons2 = new QHBoxLayout(-1,"buttons2");
98 edits = new QHBoxLayout(-1,"edits"); 99 edits = new QHBoxLayout(-1,"edits");
99 100
100 useSplitter=TRUE; 101 useSplitter=TRUE;
101 102
@@ -226,137 +227,137 @@ void Gutenbrowser::goGetit( const QString &url, bool showMsg) {
226 227
227 outDlg->showMaximized(); 228 outDlg->showMaximized();
228 outDlg->show(); 229 outDlg->show();
229 qApp->processEvents(); 230 qApp->processEvents();
230 FILE *fp; 231 FILE *fp;
231 char line[130]; 232 char line[130];
232 outDlg->OutputEdit->append( tr("Running wget") ); 233 outDlg->OutputEdit->append( tr("Running wget") );
233 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 234 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
234 sleep(1); 235 sleep(1);
235 fp = popen( (const char *) cmd, "r"); 236 fp = popen( (const char *) cmd, "r");
236 if ( !fp ) { 237 if ( !fp ) {
237 } else { 238 } else {
238 //odebug << "Issuing the command\n"+cmd << oendl; 239 //odebug << "Issuing the command\n"+cmd << oendl;
239 // system(cmd); 240 // system(cmd);
240 while ( fgets( line, sizeof line, fp)) { 241 while ( fgets( line, sizeof line, fp)) {
241 outDlg->OutputEdit->append(line); 242 outDlg->OutputEdit->append(line);
242 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 243 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
243 } 244 }
244 pclose(fp); 245 pclose(fp);
245 outDlg->OutputEdit->append("Finished downloading\n"); 246 outDlg->OutputEdit->append("Finished downloading\n");
246 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 247 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
247 qApp->processEvents(); 248 qApp->processEvents();
248 249
249 } 250 }
250 outDlg->close(); 251 outDlg->close();
251 252
252 if(outDlg) 253 if(outDlg)
253 delete outDlg; 254 delete outDlg;
254 } else { 255 } else {
255 if( brow == "Konq") { 256 if( brow == "Konq") {
256 cmd = "konqueror "+url+" &"; 257 cmd = "konqueror "+url+" &";
257 } 258 }
258 if( brow == "Opera") { //for desktop testing 259 if( brow == "Opera") { //for desktop testing
259 cmd = "opera "+url+" &"; 260 cmd = "opera "+url+" &";
260 } 261 }
261 // if( brow == "Opera") { // on Zaurus 262 // if( brow == "Opera") { // on Zaurus
262 // cmd = "operagui "+url+" &"; 263 // cmd = "operagui "+url+" &";
263 // } 264 // }
264 if( brow == "Mozilla") { 265 if( brow == "Mozilla") {
265 cmd = "mozilla "+url+" &"; 266 cmd = "mozilla "+url+" &";
266 } 267 }
267 if( brow == "Netscape") { 268 if( brow == "Netscape") {
268 cmd = "netscape "+url+" &"; 269 cmd = "netscape "+url+" &";
269 } 270 }
270 if(brow == "wget") { 271 if(brow == "wget") {
271 // cmd="wget -q "+url+" &"; 272 // cmd="wget -q "+url+" &";
272 QString tempHtml=local_library+"webster.html"; 273 QString tempHtml=local_library+"webster.html";
273 cmd="wget -O "+tempHtml+" -q "+url; 274 cmd="wget -O "+tempHtml+" -q "+url;
274 } 275 }
275 276
276 chdir(local_library); 277 chdir(local_library);
277 // //odebug << "Issuing the sys command: " << cmd << "" << oendl; 278 // //odebug << "Issuing the sys command: " << cmd << "" << oendl;
278 system(cmd); 279 system(cmd);
279 } 280 }
280} 281}
281 282
282void Gutenbrowser::toggleButtonIcons( bool useEm) { 283void Gutenbrowser::toggleButtonIcons( bool useEm) {
283 QString pixDir; 284 QString pixDir;
284 if(useEm) 285 if(useEm)
285 useEm=TRUE; 286 useEm=TRUE;
286 pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser"; 287 pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser";
287 odebug << "Docdir is "+QPEApplication::documentDir() << oendl; 288 odebug << "Docdir is "+QPEApplication::documentDir() << oendl;
288 289
289 if( useIcons && QDir( pixDir).exists() ) { 290 if( useIcons && QDir( pixDir).exists() ) {
290 LibraryButton->setPixmap( Resource::loadPixmap("home") ); //in inline 291 LibraryButton->setPixmap( Opie::Core::OResource::loadPixmap("home", Opie::Core::OResource::SmallIcon ) );
291 OpenButton->setPixmap( Resource::loadPixmap("gutenbrowser/openbook")); 292 OpenButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/openbook", Opie::Core::OResource::SmallIcon ));
292 ForwardButton->setPixmap( Resource::loadPixmap("forward"));//in inline 293 ForwardButton->setPixmap( Opie::Core::OResource::loadPixmap("forward", Opie::Core::OResource::SmallIcon ));
293 BackButton->setPixmap( Resource::loadPixmap("back") );//in inline 294 BackButton->setPixmap( Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon ) );
294 SearchButton->setPixmap( Resource::loadPixmap("gutenbrowser/search") );//in inline 295 SearchButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/search", Opie::Core::OResource::SmallIcon ) );
295 lastBmkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark_folder")); 296 lastBmkButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/bookmark_folder", Opie::Core::OResource::SmallIcon ));
296 setBookmarkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark") ); 297 setBookmarkButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/bookmark", Opie::Core::OResource::SmallIcon ) );
297 dictionaryButton->setPixmap( Resource::loadPixmap("gutenbrowser/spellcheck") ); 298 dictionaryButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/spellcheck", Opie::Core::OResource::SmallIcon ) );
298 InfoBar->setPixmap( Resource::loadPixmap("gutenbrowser/google")); 299 InfoBar->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/google", Opie::Core::OResource::SmallIcon ));
299 } 300 }
300} 301}
301 302
302 303
303bool Gutenbrowser::queryExit() 304bool Gutenbrowser::queryExit()
304{ 305{
305 int exit=QMessageBox::information(this, "Quit...", "Do your really want to quit?", 306 int exit=QMessageBox::information(this, "Quit...", "Do your really want to quit?",
306 QMessageBox::Ok, QMessageBox::Cancel); 307 QMessageBox::Ok, QMessageBox::Cancel);
307 if (exit==1) { 308 if (exit==1) {
308 writeConfig(); 309 writeConfig();
309 qApp->quit(); 310 qApp->quit();
310 } else { 311 } else {
311 }; 312 };
312 return (exit==1); 313 return (exit==1);
313} 314}
314 315
315 // SLOT IMPLEMENTATION 316 // SLOT IMPLEMENTATION
316 317
317void Gutenbrowser::slotFilePrint() { 318void Gutenbrowser::slotFilePrint() {
318} 319}
319 320
320void Gutenbrowser::ByeBye() { 321void Gutenbrowser::ByeBye() {
321 if (b_queryExit) 322 if (b_queryExit)
322 queryExit(); 323 queryExit();
323 else { 324 else {
324 // writeConfig(); 325 // writeConfig();
325 qApp->quit(); 326 qApp->quit();
326 } 327 }
327} 328}
328 329
329void Gutenbrowser::HelpBtn() { 330void Gutenbrowser::HelpBtn() {
330 HelpMe* HelpDlg; 331 HelpMe* HelpDlg;
331 HelpDlg = new HelpMe( this, "Help Dialog"); 332 HelpDlg = new HelpMe( this, "Help Dialog");
332 HelpDlg->showMaximized(); 333 HelpDlg->showMaximized();
333} 334}
334 335
335void Gutenbrowser::DownloadIndex() { 336void Gutenbrowser::DownloadIndex() {
336#ifndef Q_WS_QWS 337#ifndef Q_WS_QWS
337 { 338 {
338 switch( QMessageBox::information( 0, (tr("Download Library Index, or FTP sites?")), 339 switch( QMessageBox::information( 0, (tr("Download Library Index, or FTP sites?")),
339 (tr("Do you want to download the newest\n" 340 (tr("Do you want to download the newest\n"
340 "Project Gutenberg Library Index?\n" 341 "Project Gutenberg Library Index?\n"
341 "or select an ftp site?\n")), 342 "or select an ftp site?\n")),
342 (tr("&Library Index")), (tr("&Ftp Site")), (tr("&Cancel")), 2, 2 ) ) 343 (tr("&Library Index")), (tr("&Ftp Site")), (tr("&Cancel")), 2, 2 ) )
343 { 344 {
344 case 0: // index clicked, 345 case 0: // index clicked,
345 downloadLibIndex(); 346 downloadLibIndex();
346 break; 347 break;
347 348
348 case 1: // ftp selected 349 case 1: // ftp selected
349 downloadFtpList(); 350 downloadFtpList();
350 break; 351 break;
351 352
352 case 2: // Cancel 353 case 2: // Cancel
353 break; 354 break;
354 }; 355 };
355 } 356 }
356#endif 357#endif
357} // end DownloadIndex 358} // end DownloadIndex
358 359
359 360
360void Gutenbrowser::downloadFtpList() { 361void Gutenbrowser::downloadFtpList() {
361 // QString cmd="wget http://www.promo.net/pg/list.html"); 362 // QString cmd="wget http://www.promo.net/pg/list.html");
362 //system(cmd); 363 //system(cmd);
@@ -1710,129 +1711,130 @@ void Gutenbrowser::hideButtons()
1710 ClearButton->show(); 1711 ClearButton->show();
1711 PrintButton->show(); 1712 PrintButton->show();
1712 beginButton->show(); 1713 beginButton->show();
1713 HelpButton->show(); 1714 HelpButton->show();
1714 FontButton->show(); 1715 FontButton->show();
1715 ExitButton->show(); 1716 ExitButton->show();
1716 OptionsButton->show(); 1717 OptionsButton->show();
1717 DownloadButton->show(); 1718 DownloadButton->show();
1718 } 1719 }
1719 } 1720 }
1720} 1721}
1721 1722
1722void Gutenbrowser::focusInEvent( QFocusEvent* ) 1723void Gutenbrowser::focusInEvent( QFocusEvent* )
1723{ 1724{
1724} 1725}
1725void Gutenbrowser::focusOutEvent( QFocusEvent* ) 1726void Gutenbrowser::focusOutEvent( QFocusEvent* )
1726{ 1727{
1727} 1728}
1728 1729
1729void Gutenbrowser::cleanUp( ) 1730void Gutenbrowser::cleanUp( )
1730{ 1731{
1731 writeConfig(); 1732 writeConfig();
1732 QPEApplication::grabKeyboard(); 1733 QPEApplication::grabKeyboard();
1733 1734
1734 QPEApplication::ungrabKeyboard(); 1735 QPEApplication::ungrabKeyboard();
1735 // odebug << "Cleanup" << oendl; 1736 // odebug << "Cleanup" << oendl;
1736 if(f.isOpen()) f.close(); 1737 if(f.isOpen()) f.close();
1737} 1738}
1738 1739
1739void Gutenbrowser::fixKeys() 1740void Gutenbrowser::fixKeys()
1740{ 1741{
1741 odebug << "Attempting to fix keys" << oendl; 1742 odebug << "Attempting to fix keys" << oendl;
1742 1743
1743} 1744}
1744 1745
1745void Gutenbrowser::enableButtons(bool b) 1746void Gutenbrowser::enableButtons(bool b)
1746{ 1747{
1747 BackButton->setEnabled(b); 1748 BackButton->setEnabled(b);
1748 ForwardButton->setEnabled(b); 1749 ForwardButton->setEnabled(b);
1749 SearchButton->setEnabled(b); 1750 SearchButton->setEnabled(b);
1750 setBookmarkButton->setEnabled(b); 1751 setBookmarkButton->setEnabled(b);
1751 dictionaryButton->setEnabled(b); 1752 dictionaryButton->setEnabled(b);
1752 InfoBar->setEnabled(b); 1753 InfoBar->setEnabled(b);
1753 1754
1754 editMenu->setItemEnabled( -5, b); 1755 editMenu->setItemEnabled( -5, b);
1755 editMenu->setItemEnabled( -6, b); 1756 editMenu->setItemEnabled( -6, b);
1756 editMenu->setItemEnabled( -7, b); 1757 editMenu->setItemEnabled( -7, b);
1757 editMenu->setItemEnabled( -8, b); 1758 editMenu->setItemEnabled( -8, b);
1758 1759
1759} 1760}
1760 1761
1761void Gutenbrowser::fillWithTitles() { 1762void Gutenbrowser::fillWithTitles() {
1762 Config config("Gutenbrowser"); 1763 Config config("Gutenbrowser");
1763 config.setGroup( "Files" ); 1764 config.setGroup( "Files" );
1764 int i_numofFiles = config.readNumEntry("NumberOfFiles", 0); 1765 int i_numofFiles = config.readNumEntry("NumberOfFiles", 0);
1765 mainList->clear(); 1766 mainList->clear();
1766 QString temp; 1767 QString temp;
1767 for (int i = 1; i <= i_numofFiles; i++) { 1768 for (int i = 1; i <= i_numofFiles; i++) {
1768 temp.setNum(i); 1769 temp.setNum(i);
1769 config.setGroup( "Files" ); 1770 config.setGroup( "Files" );
1770 QString ramble = config.readEntry(temp, "" ); 1771 QString ramble = config.readEntry(temp, "" );
1771 config.setGroup( "Titles" ); 1772 config.setGroup( "Titles" );
1772 temp = config.readEntry(ramble, ""); 1773 temp = config.readEntry(ramble, "");
1773 if( !temp.isEmpty()) { 1774 if( !temp.isEmpty()) {
1774 mainList->insertItem ( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), temp, -1); 1775 mainList->insertItem ( Opie::Core::OResource::loadPixmap("gutenbrowser/gutenbrowser_sm",
1776 Opie::Core::OResource::SmallIcon ), temp, -1);
1775 } 1777 }
1776 } 1778 }
1777} 1779}
1778 1780
1779void Gutenbrowser::listClickedSlot( QListBoxItem * index) { 1781void Gutenbrowser::listClickedSlot( QListBoxItem * index) {
1780 // if( !working) { 1782 // if( !working) {
1781 // working=true; 1783 // working=true;
1782 if(index) { 1784 if(index) {
1783 // QCopEnvelope ( "QPE/System", "busy()" ); 1785 // QCopEnvelope ( "QPE/System", "busy()" );
1784 title = index->text(); 1786 title = index->text();
1785 showMainList=FALSE; 1787 showMainList=FALSE;
1786 mainList->hide(); 1788 mainList->hide();
1787 Lview->show(); 1789 Lview->show();
1788 qApp->processEvents(); 1790 qApp->processEvents();
1789 QString temp; 1791 QString temp;
1790 temp.setNum( mainList->currentItem() + 1); 1792 temp.setNum( mainList->currentItem() + 1);
1791 // openFileTitle = title; 1793 // openFileTitle = title;
1792 Config config("Gutenbrowser"); 1794 Config config("Gutenbrowser");
1793 config.setGroup( "Files" ); 1795 config.setGroup( "Files" );
1794 QString file = config.readEntry(temp, ""); 1796 QString file = config.readEntry(temp, "");
1795 odebug << "About to load" << oendl; 1797 odebug << "About to load" << oendl;
1796 if( Lview->isVisible()) 1798 if( Lview->isVisible())
1797 if(!load(file)) return; 1799 if(!load(file)) return;
1798 1800
1799 config.setGroup( title); 1801 config.setGroup( title);
1800 file_name = config.readEntry("File Name", ""); 1802 file_name = config.readEntry("File Name", "");
1801 i_pageNum = config.readNumEntry("Page Number", 1); 1803 i_pageNum = config.readNumEntry("Page Number", 1);
1802 int Bmrkrow = config.readNumEntry("LineNumber", -1); 1804 int Bmrkrow = config.readNumEntry("LineNumber", -1);
1803 if(Bmrkrow > -1) { 1805 if(Bmrkrow > -1) {
1804 if( Bmrkrow > Lview->topRow() ) { 1806 if( Bmrkrow > Lview->topRow() ) {
1805// Lview->setCursorPosition( Bmrkrow /* - Lview->topRow() */,0, FALSE ); 1807// Lview->setCursorPosition( Bmrkrow /* - Lview->topRow() */,0, FALSE );
1806 Lview->ScrollUp( Bmrkrow - Lview->topRow() ); 1808 Lview->ScrollUp( Bmrkrow - Lview->topRow() );
1807 // AdjustStatus(); 1809 // AdjustStatus();
1808 } 1810 }
1809 else if( Bmrkrow < Lview->topRow() ) { 1811 else if( Bmrkrow < Lview->topRow() ) {
1810// Lview->setCursorPosition( Lview->topRow() - Bmrkrow ,0, FALSE ); 1812// Lview->setCursorPosition( Lview->topRow() - Bmrkrow ,0, FALSE );
1811 Lview->ScrollDown( Lview->topRow() - Bmrkrow ); 1813 Lview->ScrollDown( Lview->topRow() - Bmrkrow );
1812 // AdjustStatus(); 1814 // AdjustStatus();
1813 } 1815 }
1814 } 1816 }
1815 } 1817 }
1816} 1818}
1817 1819
1818void Gutenbrowser::infoGutenbrowser() { 1820void Gutenbrowser::infoGutenbrowser() {
1819 QMessageBox::message("Info","Gutenbrowser was developed by\n" 1821 QMessageBox::message("Info","Gutenbrowser was developed by\n"
1820 "Lorn Potter\n" 1822 "Lorn Potter\n"
1821 "ljp<ljp@llornkcor.com>\n"); 1823 "ljp<ljp@llornkcor.com>\n");
1822} 1824}
1823 1825
1824void Gutenbrowser::setDocument(const QString & frozenBoogers) { 1826void Gutenbrowser::setDocument(const QString & frozenBoogers) {
1825 // this->hide(); 1827 // this->hide();
1826 qWarning("\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXSET DOCUMENT\n"); 1828 qWarning("\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXSET DOCUMENT\n");
1827 if(showMainList) { 1829 if(showMainList) {
1828 showMainList=FALSE; 1830 showMainList=FALSE;
1829 if(!mainList->isHidden()) 1831 if(!mainList->isHidden())
1830 mainList->hide(); 1832 mainList->hide();
1831 if(Lview->isHidden()) 1833 if(Lview->isHidden())
1832 Lview->show(); 1834 Lview->show();
1833 qApp->processEvents(); 1835 qApp->processEvents();
1834 } 1836 }
1835 DocLnk lnk; 1837 DocLnk lnk;
1836 lnk = DocLnk(frozenBoogers); 1838 lnk = DocLnk(frozenBoogers);
1837 qWarning("open "+frozenBoogers); 1839 qWarning("open "+frozenBoogers);
1838 // odebug << lnk.file() << oendl; 1840 // odebug << lnk.file() << oendl;
@@ -1859,129 +1861,130 @@ void Gutenbrowser::mainListPressed(int mouse, QListBoxItem * , const QPoint & )
1859 // m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 1861 // m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
1860 m.exec( QCursor::pos() ); 1862 m.exec( QCursor::pos() );
1861 } 1863 }
1862 break; 1864 break;
1863 }; 1865 };
1864} 1866}
1865 1867
1866void Gutenbrowser::menuOpen() { 1868void Gutenbrowser::menuOpen() {
1867 listClickedSlot( mainList->item( mainList->currentItem())); 1869 listClickedSlot( mainList->item( mainList->currentItem()));
1868} 1870}
1869 1871
1870void Gutenbrowser::menuGoogle() { 1872void Gutenbrowser::menuGoogle() {
1871 searchGoogle( mainList->text(mainList->currentItem())); 1873 searchGoogle( mainList->text(mainList->currentItem()));
1872} 1874}
1873 1875
1874void Gutenbrowser::searchGoogle( const QString &tempText) { 1876void Gutenbrowser::searchGoogle( const QString &tempText) {
1875 QString text = tempText; 1877 QString text = tempText;
1876 1878
1877 int eexit=QMessageBox::information(this, "Note","Do you want to search for\n"+text+ 1879 int eexit=QMessageBox::information(this, "Note","Do you want to search for\n"+text+
1878 "\non google.com?",QMessageBox::Yes, QMessageBox::No); 1880 "\non google.com?",QMessageBox::Yes, QMessageBox::No);
1879 if (eexit== 3) { 1881 if (eexit== 3) {
1880 qApp->processEvents(); 1882 qApp->processEvents();
1881 text.replace( QRegExp("\\s"), "%20"); 1883 text.replace( QRegExp("\\s"), "%20");
1882 text.replace( QRegExp("#"), ""); 1884 text.replace( QRegExp("#"), "");
1883 text.replace( QRegExp(","), "%20"); 1885 text.replace( QRegExp(","), "%20");
1884 text.replace( QRegExp("'"), "%20"); 1886 text.replace( QRegExp("'"), "%20");
1885 text.replace( QRegExp("("), ""); 1887 text.replace( QRegExp("("), "");
1886 text.replace( QRegExp(")"), ""); 1888 text.replace( QRegExp(")"), "");
1887 // text.replace( QRegExp("[0-9]"), ""); 1889 // text.replace( QRegExp("[0-9]"), "");
1888 QString s_lookup = "http://google.com/search?q="+text+"&num=30&sa=Google+Search"; 1890 QString s_lookup = "http://google.com/search?q="+text+"&num=30&sa=Google+Search";
1889 goGetit( s_lookup, true); 1891 goGetit( s_lookup, true);
1890 } 1892 }
1891 1893
1892} 1894}
1893 1895
1894void Gutenbrowser::menuEditTitle() 1896void Gutenbrowser::menuEditTitle()
1895{ 1897{
1896 int currentItem = mainList->currentItem(); 1898 int currentItem = mainList->currentItem();
1897 QString title_text = mainList->text( currentItem); 1899 QString title_text = mainList->text( currentItem);
1898 //odebug << "Selected "+title_text << oendl; 1900 //odebug << "Selected "+title_text << oendl;
1899 1901
1900 Config config("Gutenbrowser"); 1902 Config config("Gutenbrowser");
1901 config.setGroup( "Files" ); 1903 config.setGroup( "Files" );
1902 QString s_numofFiles = config.readEntry("NumberOfFiles", "0"); 1904 QString s_numofFiles = config.readEntry("NumberOfFiles", "0");
1903 int i_numofFiles = s_numofFiles.toInt(); 1905 int i_numofFiles = s_numofFiles.toInt();
1904 QString fileNum; 1906 QString fileNum;
1905 for (int i = 1; i <= i_numofFiles+1; i++) { 1907 for (int i = 1; i <= i_numofFiles+1; i++) {
1906 1908
1907 fileNum.setNum(i); 1909 fileNum.setNum(i);
1908 config.setGroup( "Files" ); 1910 config.setGroup( "Files" );
1909 QString s_filename = config.readEntry(fileNum, "" ); 1911 QString s_filename = config.readEntry(fileNum, "" );
1910 config.setGroup( "Titles" ); 1912 config.setGroup( "Titles" );
1911 QString file_title = config.readEntry( s_filename, ""); 1913 QString file_title = config.readEntry( s_filename, "");
1912 //odebug << "file_title is "+file_title << oendl; 1914 //odebug << "file_title is "+file_title << oendl;
1913 if(title_text == file_title ) { 1915 if(title_text == file_title ) {
1914 // selFile = s_filename; 1916 // selFile = s_filename;
1915 //odebug << "Edit: "+ file_title << oendl; 1917 //odebug << "Edit: "+ file_title << oendl;
1916 i=i_numofFiles+1; 1918 i=i_numofFiles+1;
1917 Edit_Title *titleEdit; 1919 Edit_Title *titleEdit;
1918 titleEdit = new Edit_Title(this,file_title ,TRUE); 1920 titleEdit = new Edit_Title(this,file_title ,TRUE);
1919 if(titleEdit->exec() !=0) { 1921 if(titleEdit->exec() !=0) {
1920 //odebug << titleEdit->newTitle << oendl; 1922 //odebug << titleEdit->newTitle << oendl;
1921 config.writeEntry( s_filename, titleEdit->newTitle); 1923 config.writeEntry( s_filename, titleEdit->newTitle);
1922 mainList->removeItem(currentItem); 1924 mainList->removeItem(currentItem);
1923 mainList->insertItem ( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), titleEdit->newTitle, currentItem); 1925 mainList->insertItem ( Opie::Core::OResource::loadPixmap("gutenbrowser/gutenbrowser_sm",
1926 Opie::Core::OResource::SmallIcon ), titleEdit->newTitle, currentItem);
1924 } 1927 }
1925 } 1928 }
1926 } 1929 }
1927 1930
1928 // getTitles(); 1931 // getTitles();
1929 mainList->triggerUpdate(true); 1932 mainList->triggerUpdate(true);
1930 1933
1931} 1934}
1932 1935
1933 1936
1934 1937
1935bool Gutenbrowser::UnZipIt(const QString &zipFile) { 1938bool Gutenbrowser::UnZipIt(const QString &zipFile) {
1936 odebug << zipFile << oendl; 1939 odebug << zipFile << oendl;
1937#ifndef Q_WS_QWS 1940#ifndef Q_WS_QWS
1938 if( QFile::exists( zipFile)) { // TODO findsome other way of dealingwithzip files. 1941 if( QFile::exists( zipFile)) { // TODO findsome other way of dealingwithzip files.
1939 bool isPgWhole=false; 1942 bool isPgWhole=false;
1940 QString thatFile; 1943 QString thatFile;
1941 if(zipFile.find("pgwhole",0,TRUE)) { 1944 if(zipFile.find("pgwhole",0,TRUE)) {
1942 isPgWhole=TRUE; 1945 isPgWhole=TRUE;
1943 thatFile= local_library +"PGWHOLE.TXT"; 1946 thatFile= local_library +"PGWHOLE.TXT";
1944 } 1947 }
1945 // else { 1948 // else {
1946 // thatFile=zipFile.left(4); 1949 // thatFile=zipFile.left(4);
1947 // } 1950 // }
1948 // odebug << (const char*)local_library.latin1() << oendl; 1951 // odebug << (const char*)local_library.latin1() << oendl;
1949 QString cmd; 1952 QString cmd;
1950#if defined(_WS_X11_) 1953#if defined(_WS_X11_)
1951 if( chdir((const char*)local_library.latin1())!=0) 1954 if( chdir((const char*)local_library.latin1())!=0)
1952 odebug << "chdir failed." << oendl; 1955 odebug << "chdir failed." << oendl;
1953 cmd = "gunzip -S .zip " + local_library+zipFile; 1956 cmd = "gunzip -S .zip " + local_library+zipFile;
1954 //cmd = "gunzip -d " + zipFile /*newestLibraryFile */+" -d " + local_library; 1957 //cmd = "gunzip -d " + zipFile /*newestLibraryFile */+" -d " + local_library;
1955#endif 1958#endif
1956#ifdef Q_WS_QWS 1959#ifdef Q_WS_QWS
1957 if( chdir((const char*)local_library.latin1())!=0) 1960 if( chdir((const char*)local_library.latin1())!=0)
1958 odebug << "chdir failed." << oendl; 1961 odebug << "chdir failed." << oendl;
1959 cmd = "unzip " + local_library+zipFile; 1962 cmd = "unzip " + local_library+zipFile;
1960 // cmd = "/usr/bin/unzip -o " + local_library+zipFile +" -d /usr/share/doc/gutenbrowser" ;//+ local_library; 1963 // cmd = "/usr/bin/unzip -o " + local_library+zipFile +" -d /usr/share/doc/gutenbrowser" ;//+ local_library;
1961#endif 1964#endif
1962 int exit=QMessageBox::information(this, "Ok to unzip?", 1965 int exit=QMessageBox::information(this, "Ok to unzip?",
1963 "Ok to unnzip\n"+ zipFile+" ?", 1966 "Ok to unnzip\n"+ zipFile+" ?",
1964 QMessageBox::Yes, QMessageBox::No); 1967 QMessageBox::Yes, QMessageBox::No);
1965 if (exit==QMessageBox::Yes) { 1968 if (exit==QMessageBox::Yes) {
1966#if defined(_WS_X11_)// 1969#if defined(_WS_X11_)//
1967 odebug << "Issuing the command "+cmd << oendl; 1970 odebug << "Issuing the command "+cmd << oendl;
1968 system( cmd); 1971 system( cmd);
1969 if( QFile::exists(thatFile)) 1972 if( QFile::exists(thatFile))
1970 remove (thatFile); 1973 remove (thatFile);
1971 if(isPgWhole) { 1974 if(isPgWhole) {
1972 if( rename("pgwhole","PGWHOLE.TXT") !=0) 1975 if( rename("pgwhole","PGWHOLE.TXT") !=0)
1973 odebug << "rename failed" << oendl; 1976 odebug << "rename failed" << oendl;
1974 } else { 1977 } else {
1975 if( rename(thatFile.left(4),thatFile.left(4)+".txt") !=0) 1978 if( rename(thatFile.left(4),thatFile.left(4)+".txt") !=0)
1976 odebug << "rename failed" << oendl; 1979 odebug << "rename failed" << oendl;
1977 } 1980 }
1978#endif 1981#endif
1979#ifdef Q_WS_QWS 1982#ifdef Q_WS_QWS
1980 odebug << "Issuing the command "+cmd << oendl; 1983 odebug << "Issuing the command "+cmd << oendl;
1981 system( cmd); 1984 system( cmd);
1982 if( QFile::exists(thatFile)) 1985 if( QFile::exists(thatFile))
1983 remove(thatFile); 1986 remove(thatFile);
1984 if(isPgWhole) { 1987 if(isPgWhole) {
1985 if( rename("pgwhole","PGWHOLE.TXT") !=0) 1988 if( rename("pgwhole","PGWHOLE.TXT") !=0)
1986 odebug << "rename failed" << oendl; 1989 odebug << "rename failed" << oendl;
1987 } else { 1990 } else {
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,84 +1,86 @@
1/*************************************************************************** 1/***************************************************************************
2 gutenbrowser.cpp - description 2 gutenbrowser.cpp - description
3 ------------------- 3 -------------------
4 begin : Mon Jul 24 22:33:12 MDT 2000 4 begin : Mon Jul 24 22:33:12 MDT 2000
5 copyright : (C) 2000 -2004 by llornkcor 5 copyright : (C) 2000 -2004 by llornkcor
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7***************************************************************************/ 7***************************************************************************/
8/*************************************************************************** 8/***************************************************************************
9 * This program is free software; you can redistribute it and/or modify * 9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by * 10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or * 11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. * 12 * (at your option) any later version. *
13 ***************************************************************************/ 13 ***************************************************************************/
14 14
15//#include "gutenbrowserData.h" 15//#include "gutenbrowserData.h"
16#include "gutenbrowser.h" 16#include "gutenbrowser.h"
17#include "multiline_ex.h" 17#include "multiline_ex.h"
18 18
19/* OPIE */ 19/* OPIE */
20#include <opie2/odebug.h> 20#include <opie2/odebug.h>
21#include <opie2/oresource.h>
22
21#include <qpe/config.h> 23#include <qpe/config.h>
22#include <qpe/fontdatabase.h> 24#include <qpe/fontdatabase.h>
23#include <qpe/menubutton.h> 25#include <qpe/menubutton.h>
24#include <qpe/resource.h> 26#include <qpe/resource.h>
25#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
26 28
27/* QT */ 29/* QT */
28#include <qfontinfo.h> 30#include <qfontinfo.h>
29#include <qtoolbutton.h> 31#include <qtoolbutton.h>
30 32
31void Gutenbrowser::initSlots() { 33void Gutenbrowser::initSlots() {
32 34
33 connect(LibraryButton,SIGNAL(released()),SLOT(LibraryBtn())); 35 connect(LibraryButton,SIGNAL(released()),SLOT(LibraryBtn()));
34 connect(OpenButton,SIGNAL(released()),SLOT(OpenBtn())); 36 connect(OpenButton,SIGNAL(released()),SLOT(OpenBtn()));
35 connect(SearchButton,SIGNAL(released()),SLOT(SearchBtn())); 37 connect(SearchButton,SIGNAL(released()),SLOT(SearchBtn()));
36 connect(ForwardButton,SIGNAL(clicked()),SLOT(ForwardBtn())); 38 connect(ForwardButton,SIGNAL(clicked()),SLOT(ForwardBtn()));
37 connect(BackButton,SIGNAL(clicked()),SLOT(BackBtn())); 39 connect(BackButton,SIGNAL(clicked()),SLOT(BackBtn()));
38 connect(setBookmarkButton,SIGNAL(released()),SLOT(setBookmark())); 40 connect(setBookmarkButton,SIGNAL(released()),SLOT(setBookmark()));
39 connect(dictionaryButton,SIGNAL(released()),SLOT(LookupBtn())); 41 connect(dictionaryButton,SIGNAL(released()),SLOT(LookupBtn()));
40 connect(InfoBar,SIGNAL(clicked()),SLOT(InfoBarClick())); 42 connect(InfoBar,SIGNAL(clicked()),SLOT(InfoBarClick()));
41 connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp())); 43 connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp()));
42 connect(mainList,SIGNAL(clicked(QListBoxItem *)),SLOT(listClickedSlot(QListBoxItem *))); 44 connect(mainList,SIGNAL(clicked(QListBoxItem *)),SLOT(listClickedSlot(QListBoxItem *)));
43 connect(bookmarksMenu,SIGNAL(activated(int)),SLOT(Bookmark(int))); 45 connect(bookmarksMenu,SIGNAL(activated(int)),SLOT(Bookmark(int)));
44} 46}
45 47
46void Gutenbrowser::initConfig() { 48void Gutenbrowser::initConfig() {
47//odebug << "Starting configuration." << oendl; 49//odebug << "Starting configuration." << oendl;
48 QDir library(local_library); 50 QDir library(local_library);
49 if ( !library.exists()) { 51 if ( !library.exists()) {
50 library.mkdir(local_library, TRUE); 52 library.mkdir(local_library, TRUE);
51 QString msg; 53 QString msg;
52// #ifndef Q_WS_WIN 54// #ifndef Q_WS_WIN
53 msg = "chmod 755 " + local_library; 55 msg = "chmod 755 " + local_library;
54 system(msg); 56 system(msg);
55// QDir pixdir(local_library+"pix"); 57// QDir pixdir(local_library+"pix");
56// if ( !pixdir.exists()) { 58// if ( !pixdir.exists()) {
57// pixdir.mkdir(local_library+"pix", TRUE); 59// pixdir.mkdir(local_library+"pix", TRUE);
58// QString msg; 60// QString msg;
59// msg = "chmod 755 " + local_library+"pix"; 61// msg = "chmod 755 " + local_library+"pix";
60// system(msg); 62// system(msg);
61// } 63// }
62// #endif 64// #endif
63 65
64 } 66 }
65 qDebug("init file is " + iniFile );; 67 qDebug("init file is " + iniFile );;
66 68
67#ifdef Q_WS_QWS 69#ifdef Q_WS_QWS
68 useSplitter=FALSE; 70 useSplitter=FALSE;
69 Config config("Gutenbrowser"); 71 Config config("Gutenbrowser");
70 72
71 config.setGroup( "General" ); 73 config.setGroup( "General" );
72//useWordWrap_CheckBox 74//useWordWrap_CheckBox
73 useIcons=TRUE; 75 useIcons=TRUE;
74#else 76#else
75 77
76 config.setGroup( "General" ); 78 config.setGroup( "General" );
77 QString s_Split=config.readEntry("Splitter", "TRUE" ); 79 QString s_Split=config.readEntry("Splitter", "TRUE" );
78 QWidget *d = QApplication::desktop(); 80 QWidget *d = QApplication::desktop();
79 int width=d->width(); 81 int width=d->width();
80 int height=d->height(); 82 int height=d->height();
81 int w=0, h=0; 83 int w=0, h=0;
82 QString str, str2; 84 QString str, str2;
83 85
84 this->setMaximumWidth(width); 86 this->setMaximumWidth(width);
@@ -110,155 +112,155 @@ void Gutenbrowser::initConfig() {
110 str = config.readEntry( "Position", str2); 112 str = config.readEntry( "Position", str2);
111 } else { 113 } else {
112 resize( 990,640 ); 114 resize( 990,640 );
113 str2.sprintf("%d,%d", (width-w)/2,(height-h)/2); 115 str2.sprintf("%d,%d", (width-w)/2,(height-h)/2);
114 str = config.readEntry( "Position", str2); 116 str = config.readEntry( "Position", str2);
115 } 117 }
116 } 118 }
117 int posX, posY; 119 int posX, posY;
118 bool ok; 120 bool ok;
119 QString goober; 121 QString goober;
120 goober=str.left( str.find(",", 0, TRUE) ); 122 goober=str.left( str.find(",", 0, TRUE) );
121 posX=goober.toInt( &ok, 10); 123 posX=goober.toInt( &ok, 10);
122 goober=str.right( str.findRev(",", -1, TRUE) ); 124 goober=str.right( str.findRev(",", -1, TRUE) );
123 posY= goober.toInt( &ok, 10); 125 posY= goober.toInt( &ok, 10);
124// move( posX, posY); 126// move( posX, posY);
125 str = config.readEntry("Icons", "TRUE"); 127 str = config.readEntry("Icons", "TRUE");
126 if(str == "TRUE") 128 if(str == "TRUE")
127 useIcons=TRUE; 129 useIcons=TRUE;
128 else 130 else
129 useIcons=FALSE; 131 useIcons=FALSE;
130#endif 132#endif
131// #if defined(_WS_WIN_) 133// #if defined(_WS_WIN_)
132// move( posX-4, posY-20); 134// move( posX-4, posY-20);
133// #endif 135// #endif
134 136
135 config.setGroup( "Browser" ); 137 config.setGroup( "Browser" );
136 brow = config.readEntry( "Preferred", "Opera"); 138 brow = config.readEntry( "Preferred", "Opera");
137 config.setGroup( "FTPsite" ); // ftp server config 139 config.setGroup( "FTPsite" ); // ftp server config
138 ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); 140 ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org");
139// ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); 141// ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) );
140 ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); 142 ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) );
141 ftp_host=ftp_host.stripWhiteSpace(); 143 ftp_host=ftp_host.stripWhiteSpace();
142 144
143 ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); 145 ftp_base_dir= config.readEntry("base", "/pub/gutenberg");
144 146
145 //bool ok2; 147 //bool ok2;
146 QString temp; 148 QString temp;
147 QString copying; 149 QString copying;
148 copying=""; 150 copying="";
149 151
150 config.setGroup("General"); 152 config.setGroup("General");
151 QString qExit; 153 QString qExit;
152 qExit=config.readEntry("queryExit","TRUE"); 154 qExit=config.readEntry("queryExit","TRUE");
153 if(qExit=="TRUE") { 155 if(qExit=="TRUE") {
154 b_queryExit=TRUE; 156 b_queryExit=TRUE;
155qDebug("lease query before leaving the library.");; 157qDebug("lease query before leaving the library.");;
156 } else { 158 } else {
157 qDebug("Please DO NOT query before leaving the library."); 159 qDebug("Please DO NOT query before leaving the library.");
158 b_queryExit=FALSE; 160 b_queryExit=FALSE;
159 } 161 }
160// bookmarks 162// bookmarks
161// config.setGroup("Titles"); 163// config.setGroup("Titles");
162// QString tmpTitle=config.readEntry(file_name,""); 164// QString tmpTitle=config.readEntry(file_name,"");
163 165
164 166
165}// end initConfig() 167}// end initConfig()
166 168
167void Gutenbrowser::initMenuBar() 169void Gutenbrowser::initMenuBar()
168{ 170{
169 qDebug("Starting menu init."); 171 qDebug("Starting menu init.");
170 // menuBar entry fileMenu 172 // menuBar entry fileMenu
171 menubar = new QPEMenuBar(this); 173 menubar = new QPEMenuBar(this);
172 174
173 fileMenu=new QPopupMenu(); 175 fileMenu=new QPopupMenu();
174 fileMenu->insertItem(Resource::loadPixmap("gutenbrowser/openbook"), 176 fileMenu->insertItem( Opie::Core::OResource::loadPixmap("gutenbrowser/openbook", Opie::Core::OResource::SmallIcon ),
175 "Open Local Library...", this, SLOT( OpenBtn()) ); 177 "Open Local Library...", this, SLOT( OpenBtn()) );
176// fileMenu->insertItem("Download FTPSite", this, SLOT( downloadFtpList()) ); 178// fileMenu->insertItem("Download FTPSite", this, SLOT( downloadFtpList()) );
177 fileMenu->insertItem( Resource::loadPixmap("home"), 179 fileMenu->insertItem( Opie::Core::OResource::loadPixmap("home", Opie::Core::OResource::SmallIcon ),
178 "Download Library Index", this, SLOT( downloadLibIndex()) ); 180 "Download Library Index", this, SLOT( downloadLibIndex()) );
179 fileMenu->insertItem( Resource::loadPixmap("quit"), 181 fileMenu->insertItem( Opie::Core::OResource::loadPixmap("quit", Opie::Core::OResource::SmallIcon ),
180 "Quit Gutenbrowser...", this, SLOT( ByeBye()) ); 182 "Quit Gutenbrowser...", this, SLOT( ByeBye()) );
181 // menuBar entry editMenu 183 // menuBar entry editMenu
182 184
183 editMenu=new QPopupMenu(); 185 editMenu=new QPopupMenu();
184 186
185 editMenu->insertItem(Resource::loadPixmap("up"), "Top", 187 editMenu->insertItem( Opie::Core::OResource::loadPixmap("up", Opie::Core::OResource::SmallIcon ), "Top",
186 this, SLOT(TopBtn()) ); 188 this, SLOT(TopBtn()) );
187 editMenu->insertItem( Resource::loadPixmap("back"), "Beginning", 189 editMenu->insertItem( Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon ), "Beginning",
188 this, SLOT(doBeginBtn()) ); 190 this, SLOT(doBeginBtn()) );
189 editMenu->insertItem( Resource::loadPixmap("gutenbrowser/search"), "Search", 191 editMenu->insertItem( Opie::Core::OResource::loadPixmap("gutenbrowser/search", Opie::Core::OResource::SmallIcon ), "Search",
190 this, SLOT(SearchBtn()) ); 192 this, SLOT(SearchBtn()) );
191 193
192 editMenu->insertItem("Clear", this, SLOT(ClearEdit()) ); 194 editMenu->insertItem("Clear", this, SLOT(ClearEdit()) );
193 195
194 optionsMenu= new QPopupMenu(); 196 optionsMenu= new QPopupMenu();
195 optionsMenu->insertItem( Resource::loadPixmap("gutenbrowser/configure"), 197 optionsMenu->insertItem( Opie::Core::OResource::loadPixmap("gutenbrowser/configure", Opie::Core::OResource::SmallIcon ),
196 "Configure", this, SLOT(doOptions()) ); 198 "Configure", this, SLOT(doOptions()) );
197 199
198 donateMenu = new QPopupMenu(); 200 donateMenu = new QPopupMenu();
199// donateMenu->insertItem("Gutenberg", this, SLOT(donateGutenberg()) ); 201// donateMenu->insertItem("Gutenberg", this, SLOT(donateGutenberg()) );
200 donateMenu->insertItem( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), 202 donateMenu->insertItem( Opie::Core::OResource::loadPixmap("gutenbrowser/gutenbrowser_sm", Opie::Core::OResource::SmallIcon ),
201 "Gutenbrowser Developer", this, SLOT(infoGutenbrowser()) ); 203 "Gutenbrowser Developer", this, SLOT(infoGutenbrowser()) );
202 204
203 menubar->insertItem("File", fileMenu); 205 menubar->insertItem("File", fileMenu);
204 menubar->insertItem("Page", editMenu); 206 menubar->insertItem("Page", editMenu);
205 menubar->insertItem("Options", optionsMenu); 207 menubar->insertItem("Options", optionsMenu);
206// menubar->insertItem("More Info", donateMenu); 208// menubar->insertItem("More Info", donateMenu);
207 209
208 menu->addWidget( menubar,0); 210 menu->addWidget( menubar,0);
209 211
210 topLayout->addLayout( menu, 0); 212 topLayout->addLayout( menu, 0);
211} 213}
212 214
213void Gutenbrowser::initButtonBar() 215void Gutenbrowser::initButtonBar()
214{ 216{
215 qDebug("Starting buttonbar init."); 217 qDebug("Starting buttonbar init.");
216 218
217 OpenButton = new QPushButton( this, "OpenButton" ); 219 OpenButton = new QPushButton( this, "OpenButton" );
218 OpenButton->setFocusPolicy( QWidget::TabFocus ); 220 OpenButton->setFocusPolicy( QWidget::TabFocus );
219 LibraryButton = new QPushButton( this, "LibraryButton" ); 221 LibraryButton = new QPushButton( this, "LibraryButton" );
220 LibraryButton->setFocusPolicy( QWidget::TabFocus ); 222 LibraryButton->setFocusPolicy( QWidget::TabFocus );
221 223
222 BackButton = new QPushButton( this, "BackButton" ); 224 BackButton = new QPushButton( this, "BackButton" );
223 BackButton->setFocusPolicy( QWidget::TabFocus ); 225 BackButton->setFocusPolicy( QWidget::TabFocus );
224 BackButton->setAutoRepeat(TRUE); 226 BackButton->setAutoRepeat(TRUE);
225 227
226 ForwardButton = new QPushButton( this, "ForwardButton" ); 228 ForwardButton = new QPushButton( this, "ForwardButton" );
227 ForwardButton->setFocusPolicy( QWidget::TabFocus ); 229 ForwardButton->setFocusPolicy( QWidget::TabFocus );
228// ForwardButton->setAutoRepeat(TRUE); 230// ForwardButton->setAutoRepeat(TRUE);
229 231
230 SearchButton = new QPushButton( this, "SearchButton" ); 232 SearchButton = new QPushButton( this, "SearchButton" );
231 SearchButton->setFocusPolicy( QWidget::TabFocus ); 233 SearchButton->setFocusPolicy( QWidget::TabFocus );
232 234
233 setBookmarkButton = new QPushButton( this, "setBookmark" ); 235 setBookmarkButton = new QPushButton( this, "setBookmark" );
234 setBookmarkButton->setFocusPolicy( QWidget::TabFocus ); 236 setBookmarkButton->setFocusPolicy( QWidget::TabFocus );
235 237
236 lastBmkButton = new MenuButton( this, "lastBmkButton" ); 238 lastBmkButton = new MenuButton( this, "lastBmkButton" );
237 lastBmkButton->setFocusPolicy( QWidget::TabFocus ); 239 lastBmkButton->setFocusPolicy( QWidget::TabFocus );
238 240
239 bookmarksMenu = new QPopupMenu(); 241 bookmarksMenu = new QPopupMenu();
240 bookmarksMenu->insertItem("Last Set", this, SLOT(Bookmark( int) )); 242 bookmarksMenu->insertItem("Last Set", this, SLOT(Bookmark( int) ));
241 243
242 lastBmkButton->setPopup(bookmarksMenu); 244 lastBmkButton->setPopup(bookmarksMenu);
243 245
244 dictionaryButton = new QPushButton( this, "dictionaryButton" ); 246 dictionaryButton = new QPushButton( this, "dictionaryButton" );
245 dictionaryButton->setFocusPolicy( QWidget::TabFocus ); 247 dictionaryButton->setFocusPolicy( QWidget::TabFocus );
246 248
247 InfoBar = new QPushButton( this, "Info_Bar" ); 249 InfoBar = new QPushButton( this, "Info_Bar" );
248// if(!useSplitter) { 250// if(!useSplitter) {
249 251
250 buttonsHidden=FALSE; 252 buttonsHidden=FALSE;
251 buttons2->setSpacing(2); 253 buttons2->setSpacing(2);
252 buttons2->addWidget(OpenButton, 0, AlignCenter); 254 buttons2->addWidget(OpenButton, 0, AlignCenter);
253 buttons2->addWidget(LibraryButton, 0, AlignCenter); 255 buttons2->addWidget(LibraryButton, 0, AlignCenter);
254 buttons2->addWidget(BackButton, 0, AlignCenter); 256 buttons2->addWidget(BackButton, 0, AlignCenter);
255 buttons2->addWidget(ForwardButton, 0, AlignCenter); 257 buttons2->addWidget(ForwardButton, 0, AlignCenter);
256 buttons2->addWidget(SearchButton, 0, AlignCenter); 258 buttons2->addWidget(SearchButton, 0, AlignCenter);
257 buttons2->addWidget(setBookmarkButton, 0, AlignCenter); 259 buttons2->addWidget(setBookmarkButton, 0, AlignCenter);
258 buttons2->addWidget(lastBmkButton, 0, AlignCenter); 260 buttons2->addWidget(lastBmkButton, 0, AlignCenter);
259 buttons2->addWidget(dictionaryButton, 0, AlignCenter); 261 buttons2->addWidget(dictionaryButton, 0, AlignCenter);
260 buttons2->addWidget(InfoBar, 0, AlignCenter); 262 buttons2->addWidget(InfoBar, 0, AlignCenter);
261 263
262 topLayout->setSpacing(0); 264 topLayout->setSpacing(0);
263 topLayout->addLayout( buttons2,0); 265 topLayout->addLayout( buttons2,0);
264} 266}