summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/gutenbrowser.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
index d0af114..644fae8 100644
--- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
+++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
@@ -1,332 +1,332 @@
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 <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
33#include <qpe/fontdatabase.h> 33#include <qpe/fontdatabase.h>
34#include <qpe/config.h> 34#include <qpe/config.h>
35#include <qpe/qcopenvelope_qws.h> 35#include <qpe/qcopenvelope_qws.h>
36#include <qpe/mimetype.h> 36#include <qpe/mimetype.h>
37#include <qpe/resource.h> 37#include <qpe/resource.h>
38#include <qpe/applnk.h> 38#include <qpe/applnk.h>
39 39
40/* QT */ 40/* QT */
41#include <qregexp.h> 41#include <qregexp.h>
42#include <qregion.h> 42#include <qregion.h>
43#include <qpaintdevicemetrics.h> 43#include <qpaintdevicemetrics.h>
44#include <qvaluelist.h> 44#include <qvaluelist.h>
45#include <qlabel.h> 45#include <qlabel.h>
46#include <qclipboard.h> 46#include <qclipboard.h>
47#include <qpainter.h> 47#include <qpainter.h>
48#include <qpalette.h> 48#include <qpalette.h>
49#include <qobjectlist.h> 49#include <qobjectlist.h>
50#include <qfontdialog.h> 50#include <qfontdialog.h>
51#include <qtextview.h> 51#include <qtextview.h>
52#include <qbrush.h> 52#include <qbrush.h>
53#include <qfile.h> 53#include <qfile.h>
54#include <qfontinfo.h> 54#include <qfontinfo.h>
55#include <qscrollview.h> 55#include <qscrollview.h>
56#include <qpoint.h> 56#include <qpoint.h>
57 57
58/* STD */ 58/* STD */
59#include <stdio.h> 59#include <stdio.h>
60#include <stdlib.h> 60#include <stdlib.h>
61#include <unistd.h> 61#include <unistd.h>
62#include <sys/stat.h> 62#include <sys/stat.h>
63#include <fcntl.h> 63#include <fcntl.h>
64#include <errno.h> 64#include <errno.h>
65 65
66static const int nfontsizes = 9; 66static const int nfontsizes = 9;
67static const int fontsize[nfontsizes] = {8,9,10,11,12,13,14,18,24}; 67static const int fontsize[nfontsizes] = {8,9,10,11,12,13,14,18,24};
68 68
69#ifdef NOQUICKLAUNCH 69#ifdef NOQUICKLAUNCH
70Gutenbrowser::Gutenbrowser() 70Gutenbrowser::Gutenbrowser()
71 Gutenbrowser(); 71 Gutenbrowser();
72#else 72#else
73Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags ) 73Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags )
74#endif 74#endif
75 : QMainWindow() 75 : QMainWindow()
76{ 76{
77 // QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 77 // QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
78 // QCopEnvelope e("QPE/System", "grabKeyboard(QString)" ); 78 // QCopEnvelope e("QPE/System", "grabKeyboard(QString)" );
79 // e << ""; 79 // e << "";
80 // QPEApplication::grabKeyboard(); 80 // QPEApplication::grabKeyboard();
81 showMainList=TRUE; 81 showMainList=TRUE;
82 working=false; 82 working=false;
83 this->setUpdatesEnabled(TRUE); 83 this->setUpdatesEnabled(TRUE);
84 // #ifndef Q_WS_QWS 84 // #ifndef Q_WS_QWS
85 QString msg; 85 QString msg;
86 msg="You have now entered unto gutenbrowser,\n"; 86 msg="You have now entered unto gutenbrowser,\n";
87 msg+="make your self at home, sit back, relax and read something great.\n"; 87 msg+="make your self at home, sit back, relax and read something great.\n";
88 88
89 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; 89 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
90 setCaption("Gutenbrowser");// Embedded " VERSION); 90 setCaption("Gutenbrowser");// Embedded " VERSION);
91 this->setUpdatesEnabled(TRUE); 91 this->setUpdatesEnabled(TRUE);
92 92
93 // bool firstTime=FALSE; 93 // bool firstTime=FALSE;
94 topLayout = new QVBoxLayout( this, 0, 0, "topLayout"); 94 topLayout = new QVBoxLayout( this, 0, 0, "topLayout");
95 95
96 menu = new QHBoxLayout(-1,"menu"); 96 menu = new QHBoxLayout(-1,"menu");
97 buttons2 = new QHBoxLayout(-1,"buttons2"); 97 buttons2 = new QHBoxLayout(-1,"buttons2");
98 edits = new QHBoxLayout(-1,"edits"); 98 edits = new QHBoxLayout(-1,"edits");
99 99
100 useSplitter=TRUE; 100 useSplitter=TRUE;
101 101
102 initConfig(); 102 initConfig();
103 initMenuBar(); 103 initMenuBar();
104 initButtonBar(); 104 initButtonBar();
105 initStatusBar(); 105 initStatusBar();
106 initView(); 106 initView();
107 initSlots(); 107 initSlots();
108 qDebug("init finished"); 108 qDebug("init finished");
109 QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold); 109 QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold);
110 110
111 connect( mainList, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint &)), 111 connect( mainList, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint &)),
112 this, SLOT( mainListPressed(int, QListBoxItem *, const QPoint &)) ); 112 this, SLOT( mainListPressed(int, QListBoxItem *, const QPoint &)) );
113 if( useIcons) 113 if( useIcons)
114 toggleButtonIcons( TRUE); 114 toggleButtonIcons( TRUE);
115 else 115 else
116 toggleButtonIcons( FALSE); 116 toggleButtonIcons( FALSE);
117 117
118 enableButtons(false); 118 enableButtons(false);
119 119
120 Config config("Gutenbrowser"); // populate menubuttonlist 120 Config config("Gutenbrowser"); // populate menubuttonlist
121 config.setGroup("General"); 121 config.setGroup("General");
122 122
123 config.setGroup( "Files" ); 123 config.setGroup( "Files" );
124 QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); 124 QString s_numofFiles = config.readEntry("NumberOfFiles", "0" );
125 int i_numofFiles = s_numofFiles.toInt(); 125 int i_numofFiles = s_numofFiles.toInt();
126 126
127 QString tempFileName; 127 QString tempFileName;
128 128
129 for (int i = 0; i <= i_numofFiles; i++) { 129 for (int i = 0; i <= i_numofFiles; i++) {
130 // tempFileName.setNum(i); 130 // tempFileName.setNum(i);
131 config.setGroup( "Files" ); 131 config.setGroup( "Files" );
132 QString ramble = config.readEntry( QString::number(i), "" ); 132 QString ramble = config.readEntry( QString::number(i), "" );
133 133
134 config.setGroup( "Titles" ); 134 config.setGroup( "Titles" );
135 QString tempTitle = config.readEntry( ramble, ""); 135 QString tempTitle = config.readEntry( ramble, "");
136 config.setGroup( tempTitle); 136 config.setGroup( tempTitle);
137 int index=config.readNumEntry( "LineNumber", -1 ); 137 int index = config.readNumEntry( "LineNumber", -1 );
138 if( index != -1) { 138 if( index != -1) {
139 odebug << tempTitle << oendl; 139 odebug << tempTitle << oendl;
140 bookmarksMenu->insertItem( tempTitle); 140 if(!tempTitle.isEmpty()) bookmarksMenu->insertItem( tempTitle);
141 } 141 }
142 } 142 }
143 143
144 // QString gutenIndex= local_library + "GUTINDEX.ALL"; 144 // QString gutenIndex= local_library + "GUTINDEX.ALL";
145 QString gutenIndex = QPEApplication::qpeDir()+ "/etc/gutenbrowser/GUTINDEX.ALL"; 145 QString gutenIndex = QPEApplication::qpeDir()+ "/etc/gutenbrowser/GUTINDEX.ALL";
146 qDebug("gutenindex "+gutenIndex ); 146 qDebug("gutenindex "+gutenIndex );
147 if( QFile( gutenIndex).exists() ) { 147 if( QFile( gutenIndex).exists() ) {
148 indexLib.setName( gutenIndex); 148 indexLib.setName( gutenIndex);
149 } else { 149 } else {
150 QString localLibIndexFile = QPEApplication::qpeDir()+ "/etc/gutenbrowser/PGWHOLE.TXT"; 150 QString localLibIndexFile = QPEApplication::qpeDir()+ "/etc/gutenbrowser/PGWHOLE.TXT";
151 // QString localLibIndexFile= local_library + "PGWHOLE.TXT"; 151 // QString localLibIndexFile= local_library + "PGWHOLE.TXT";
152 newindexLib.setName( localLibIndexFile); 152 newindexLib.setName( localLibIndexFile);
153 } 153 }
154 qDebug("attempting new library"); 154 qDebug("attempting new library");
155 LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */); 155 LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */);
156 loadCheck = false; 156 loadCheck = false;
157 chdir(local_library); 157 chdir(local_library);
158 if(!showMainList) { 158 if(!showMainList) {
159 Lview->setFocus(); 159 Lview->setFocus();
160 // if(firstTime) 160 // if(firstTime)
161 // Bookmark(); 161 // Bookmark();
162 for (int i=1;i< qApp->argc();i++) { 162 for (int i=1;i< qApp->argc();i++) {
163 qDebug("Suppose we open somethin"); 163 qDebug("Suppose we open somethin");
164 if(!load(qApp->argv()[i])) return; 164 if(!load(qApp->argv()[i])) return;
165 } 165 }
166 } else { 166 } else {
167 fillWithTitles(); 167 fillWithTitles();
168 mainList->setFocus(); 168 mainList->setFocus();
169 // mainList->setCurrentItem(0); 169 // mainList->setCurrentItem(0);
170 170
171 } 171 }
172 writeConfig(); 172 writeConfig();
173 QTimer::singleShot( 250, this, SLOT(hideView()) ); 173 QTimer::singleShot( 250, this, SLOT(hideView()) );
174} //end init 174} //end init
175 175
176Gutenbrowser::~Gutenbrowser() { 176Gutenbrowser::~Gutenbrowser() {
177 // QPEApplication::grabKeyboard(); 177 // QPEApplication::grabKeyboard();
178 // QPEApplication::ungrabKeyboard(); 178 // QPEApplication::ungrabKeyboard();
179 odebug << "Exit" << oendl; 179 odebug << "Exit" << oendl;
180} 180}
181 181
182 /* 182 /*
183 Google.com search */ 183 Google.com search */
184void Gutenbrowser::InfoBarClick() { 184void Gutenbrowser::InfoBarClick() {
185 QString text; 185 QString text;
186 if( Lview->hasSelectedText()) { 186 if( Lview->hasSelectedText()) {
187 Lview->copy(); 187 Lview->copy();
188 QClipboard *cb = QApplication::clipboard(); 188 QClipboard *cb = QApplication::clipboard();
189 text = cb->text(); 189 text = cb->text();
190 } else { 190 } else {
191 // text=title; 191 // text=title;
192 text=this->caption(); 192 text=this->caption();
193 } 193 }
194 searchGoogle(text); 194 searchGoogle(text);
195} 195}
196 196
197 /* 197 /*
198 download http with wget or preferred browser */ 198 download http with wget or preferred browser */
199void Gutenbrowser::goGetit( const QString &url, bool showMsg) { 199void Gutenbrowser::goGetit( const QString &url, bool showMsg) {
200 // int eexit=0; 200 // int eexit=0;
201 QString cmd; 201 QString cmd;
202 // config.read(); 202 // config.read();
203 qApp->processEvents(); 203 qApp->processEvents();
204 QString filename = QPEApplication::qpeDir(); 204 QString filename = QPEApplication::qpeDir();
205 if(filename.right(1)!="/") 205 if(filename.right(1)!="/")
206 filename+="/etc/gutenbrowser/"; 206 filename+="/etc/gutenbrowser/";
207 else 207 else
208 filename+="etc/gutenbrowser/"; 208 filename+="etc/gutenbrowser/";
209 odebug << "filename "+filename << oendl; 209 odebug << "filename "+filename << oendl;
210 // QString filename = QDir::homeDirPath()+"/Applications/gutenbrowser/"; 210 // QString filename = QDir::homeDirPath()+"/Applications/gutenbrowser/";
211 211
212 filename += url.right( url.length() - url.findRev("/",-1,TRUE) -1); 212 filename += url.right( url.length() - url.findRev("/",-1,TRUE) -1);
213 213
214 Config config("Gutenbrowser"); 214 Config config("Gutenbrowser");
215 config.setGroup( "Browser" ); 215 config.setGroup( "Browser" );
216 QString brow = config.readEntry("Preferred", "Opera"); 216 QString brow = config.readEntry("Preferred", "Opera");
217 odebug << "Preferred browser is "+brow << oendl; 217 odebug << "Preferred browser is "+brow << oendl;
218 if(!showMsg) { //if we just get the gutenindex.all 218 if(!showMsg) { //if we just get the gutenindex.all
219 cmd="wget -O " + filename +" " + url+" 2>&1" ; 219 cmd="wget -O " + filename +" " + url+" 2>&1" ;
220 chdir(local_library); 220 chdir(local_library);
221 odebug << "Issuing the system command: " << cmd << "" << oendl; 221 odebug << "Issuing the system command: " << cmd << "" << oendl;
222 222
223 Output *outDlg; 223 Output *outDlg;
224 outDlg = new Output(this, tr("Gutenbrowser Output"),FALSE); 224 outDlg = new Output(this, tr("Gutenbrowser Output"),FALSE);
225 outDlg->showMaximized(); 225 outDlg->showMaximized();
226 outDlg->show(); 226 outDlg->show();
227 qApp->processEvents(); 227 qApp->processEvents();
228 FILE *fp; 228 FILE *fp;
229 char line[130]; 229 char line[130];
230 outDlg->OutputEdit->append( tr("Running wget") ); 230 outDlg->OutputEdit->append( tr("Running wget") );
231 sleep(1); 231 sleep(1);
232 fp = popen( (const char *) cmd, "r"); 232 fp = popen( (const char *) cmd, "r");
233 odebug << "Issuing the command\n"+cmd << oendl; 233 odebug << "Issuing the command\n"+cmd << oendl;
234 // system(cmd); 234 // system(cmd);
235 while ( fgets( line, sizeof line, fp)) { 235 while ( fgets( line, sizeof line, fp)) {
236 outDlg->OutputEdit->append(line); 236 outDlg->OutputEdit->append(line);
237// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 237// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
238 } 238 }
239 pclose(fp); 239 pclose(fp);
240 outDlg->close(); 240 outDlg->close();
241 if(outDlg) 241 if(outDlg)
242 delete outDlg; 242 delete outDlg;
243 } else { 243 } else {
244 if( brow == "Konq") { 244 if( brow == "Konq") {
245 cmd = "konqueror "+url+" &"; 245 cmd = "konqueror "+url+" &";
246 } 246 }
247 if( brow == "Opera") { //for desktop testing 247 if( brow == "Opera") { //for desktop testing
248 cmd = "opera "+url+" &"; 248 cmd = "opera "+url+" &";
249 } 249 }
250 // if( brow == "Opera") { // on Zaurus 250 // if( brow == "Opera") { // on Zaurus
251 // cmd = "operagui "+url+" &"; 251 // cmd = "operagui "+url+" &";
252 // } 252 // }
253 if( brow == "Mozilla") { 253 if( brow == "Mozilla") {
254 cmd = "mozilla "+url+" &"; 254 cmd = "mozilla "+url+" &";
255 } 255 }
256 if( brow == "Netscape") { 256 if( brow == "Netscape") {
257 cmd = "netscape "+url+" &"; 257 cmd = "netscape "+url+" &";
258 } 258 }
259 if(brow == "wget") { 259 if(brow == "wget") {
260 // cmd="wget -q "+url+" &"; 260 // cmd="wget -q "+url+" &";
261 QString tempHtml=local_library+"webster.html"; 261 QString tempHtml=local_library+"webster.html";
262 cmd="wget -O "+tempHtml+" -q "+url; 262 cmd="wget -O "+tempHtml+" -q "+url;
263 } 263 }
264 264
265 chdir(local_library); 265 chdir(local_library);
266 odebug << "Issuing the sys command: " << cmd << "" << oendl; 266 odebug << "Issuing the sys command: " << cmd << "" << oendl;
267 system(cmd); 267 system(cmd);
268 } 268 }
269} 269}
270 270
271void Gutenbrowser::toggleButtonIcons( bool useEm) { 271void Gutenbrowser::toggleButtonIcons( bool useEm) {
272 QString pixDir; 272 QString pixDir;
273 if(useEm) 273 if(useEm)
274 useEm=TRUE; 274 useEm=TRUE;
275 pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser"; 275 pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser";
276 odebug << "Docdir is "+QPEApplication::documentDir() << oendl; 276 odebug << "Docdir is "+QPEApplication::documentDir() << oendl;
277 277
278 if( useIcons && QDir( pixDir).exists() ) { 278 if( useIcons && QDir( pixDir).exists() ) {
279 LibraryButton->setPixmap( Resource::loadPixmap("home") ); //in inline 279 LibraryButton->setPixmap( Resource::loadPixmap("home") ); //in inline
280 OpenButton->setPixmap( Resource::loadPixmap("gutenbrowser/openbook")); 280 OpenButton->setPixmap( Resource::loadPixmap("gutenbrowser/openbook"));
281 ForwardButton->setPixmap( Resource::loadPixmap("forward"));//in inline 281 ForwardButton->setPixmap( Resource::loadPixmap("forward"));//in inline
282 BackButton->setPixmap( Resource::loadPixmap("back") );//in inline 282 BackButton->setPixmap( Resource::loadPixmap("back") );//in inline
283 SearchButton->setPixmap( Resource::loadPixmap("gutenbrowser/search") );//in inline 283 SearchButton->setPixmap( Resource::loadPixmap("gutenbrowser/search") );//in inline
284 lastBmkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark_folder")); 284 lastBmkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark_folder"));
285 setBookmarkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark") ); 285 setBookmarkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark") );
286 dictionaryButton->setPixmap( Resource::loadPixmap("gutenbrowser/spellcheck") ); 286 dictionaryButton->setPixmap( Resource::loadPixmap("gutenbrowser/spellcheck") );
287 InfoBar->setPixmap( Resource::loadPixmap("gutenbrowser/google")); 287 InfoBar->setPixmap( Resource::loadPixmap("gutenbrowser/google"));
288 } 288 }
289} 289}
290 290
291 291
292bool Gutenbrowser::queryExit() 292bool Gutenbrowser::queryExit()
293{ 293{
294 int exit=QMessageBox::information(this, "Quit...", "Do your really want to quit?", 294 int exit=QMessageBox::information(this, "Quit...", "Do your really want to quit?",
295 QMessageBox::Ok, QMessageBox::Cancel); 295 QMessageBox::Ok, QMessageBox::Cancel);
296 if (exit==1) { 296 if (exit==1) {
297 writeConfig(); 297 writeConfig();
298 qApp->quit(); 298 qApp->quit();
299 } else { 299 } else {
300 }; 300 };
301 return (exit==1); 301 return (exit==1);
302} 302}
303 303
304 // SLOT IMPLEMENTATION 304 // SLOT IMPLEMENTATION
305 305
306void Gutenbrowser::slotFilePrint() { 306void Gutenbrowser::slotFilePrint() {
307} 307}
308 308
309void Gutenbrowser::ByeBye() { 309void Gutenbrowser::ByeBye() {
310 if (b_queryExit) 310 if (b_queryExit)
311 queryExit(); 311 queryExit();
312 else { 312 else {
313 // writeConfig(); 313 // writeConfig();
314 qApp->quit(); 314 qApp->quit();
315 } 315 }
316} 316}
317 317
318void Gutenbrowser::HelpBtn() { 318void Gutenbrowser::HelpBtn() {
319 HelpMe* HelpDlg; 319 HelpMe* HelpDlg;
320 HelpDlg = new HelpMe( this, "Help Dialog"); 320 HelpDlg = new HelpMe( this, "Help Dialog");
321 HelpDlg->showMaximized(); 321 HelpDlg->showMaximized();
322} 322}
323 323
324void Gutenbrowser::DownloadIndex() { 324void Gutenbrowser::DownloadIndex() {
325#ifndef Q_WS_QWS 325#ifndef Q_WS_QWS
326 { 326 {
327 switch( QMessageBox::information( 0, (tr("Download Library Index, or FTP sites?")), 327 switch( QMessageBox::information( 0, (tr("Download Library Index, or FTP sites?")),
328 (tr("Do you want to download the newest\n" 328 (tr("Do you want to download the newest\n"
329 "Project Gutenberg Library Index?\n" 329 "Project Gutenberg Library Index?\n"
330 "or select an ftp site?\n")), 330 "or select an ftp site?\n")),
331 (tr("&Library Index")), (tr("&Ftp Site")), (tr("&Cancel")), 2, 2 ) ) 331 (tr("&Library Index")), (tr("&Ftp Site")), (tr("&Cancel")), 2, 2 ) )
332 { 332 {
@@ -372,385 +372,385 @@ void Gutenbrowser::downloadLibIndex() {
372 dir.cd("", TRUE); 372 dir.cd("", TRUE);
373 goGetit( "http://sailor.gutenberg.org/GUTINDEX.ALL", false); // until ghttp works on binaries -qt3 373 goGetit( "http://sailor.gutenberg.org/GUTINDEX.ALL", false); // until ghttp works on binaries -qt3
374 // goGetit( "http://www.gutenberg.net/pgwhole.zip", true); // until ghttp works on binaries -qt3 374 // goGetit( "http://www.gutenberg.net/pgwhole.zip", true); // until ghttp works on binaries -qt3
375 // NetworkDialog *NetworkDlg; 375 // NetworkDialog *NetworkDlg;
376 // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkUrl, outputFile ); 376 // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkUrl, outputFile );
377 // if( NetworkDlg->exec() != 0 ) 377 // if( NetworkDlg->exec() != 0 )
378 // { // use new, improved, *INSTANT* network-dialog-file-getterer 378 // { // use new, improved, *INSTANT* network-dialog-file-getterer
379 //// QMessageBox::message("Note",""); 379 //// QMessageBox::message("Note","");
380 // } 380 // }
381 // if(NetworkDlg) 381 // if(NetworkDlg)
382 // delete NetworkDlg; 382 // delete NetworkDlg;
383} 383}
384 384
385 385
386void Gutenbrowser::PrintBtn() { 386void Gutenbrowser::PrintBtn() {
387} 387}
388 388
389void Gutenbrowser::SearchBtn() { 389void Gutenbrowser::SearchBtn() {
390 if( loadCheck) { 390 if( loadCheck) {
391 odebug << "loadCheck: we have a loaded doc" << oendl; 391 odebug << "loadCheck: we have a loaded doc" << oendl;
392 Search(); 392 Search();
393 } 393 }
394 // else 394 // else
395 // QMessageBox::message("Note","Sorry, can't search. No etext is loaded"); 395 // QMessageBox::message("Note","Sorry, can't search. No etext is loaded");
396} 396}
397 397
398 398
399void Gutenbrowser::ForwardBtn() { 399void Gutenbrowser::ForwardBtn() {
400 400
401 if( !ForwardButton->autoRepeat() && !ForwardButton->isDown()) { 401 if( !ForwardButton->autoRepeat() && !ForwardButton->isDown()) {
402 402
403 QString s; 403 QString s;
404 QString insertString; 404 QString insertString;
405 int pageSize= Lview->PageSize(); 405 int pageSize= Lview->PageSize();
406 Lview->clear(); 406 Lview->clear();
407 407
408 for(int fd=0; fd < pageSize - 1;fd++) { 408 for(int fd=0; fd < pageSize - 1;fd++) {
409 f.readLine(s, 256); 409 f.readLine(s, 256);
410 if(useWrap) 410 if(useWrap)
411 s.replace(QRegExp("\n"),""); 411 s.replace(QRegExp("\n"),"");
412 insertString+=s; 412 insertString+=s;
413 Lview->insertLine( s, -1); 413 Lview->insertLine( s, -1);
414 // odebug << s << oendl; 414 // odebug << s << oendl;
415 currentLine++; 415 currentLine++;
416 } 416 }
417 // Lview->insertAt( insertString,0,0, FALSE); 417 // Lview->insertAt( insertString,0,0, FALSE);
418 currentFilePos = f.at(); 418 currentFilePos = f.at();
419 // if( i_pageNum != pages) { 419 // if( i_pageNum != pages) {
420 // Lview->MultiLine_Ex::pageDown( FALSE); 420 // Lview->MultiLine_Ex::pageDown( FALSE);
421 i_pageNum++; 421 i_pageNum++;
422 pageStopArray.resize(i_pageNum + 1); 422 pageStopArray.resize(i_pageNum + 1);
423 // int length = Lview->length(); 423 // int length = Lview->length();
424 424
425 pageStopArray[i_pageNum ] = currentFilePos; 425 pageStopArray[i_pageNum ] = currentFilePos;
426 odebug << currentFilePos << " current page is number " << i_pageNum 426 odebug << currentFilePos << " current page is number " << i_pageNum
427 << ", pagesize " << pageSize << ", length " << Lview->length() 427 << ", pagesize " << pageSize << ", length " << Lview->length()
428 << ", current " << pageStopArray[i_pageNum] << oendl; 428 << ", current " << pageStopArray[i_pageNum] << oendl;
429 setStatus(); 429 setStatus();
430// Lview->setCursorPosition( 0, 0, FALSE); 430// Lview->setCursorPosition( 0, 0, FALSE);
431 // } 431 // }
432 432
433 } else { 433 } else {
434 odebug << "bal" << oendl; 434 odebug << "bal" << oendl;
435 // if( i_pageNum != pages) { 435 // if( i_pageNum != pages) {
436 436
437 // // int newTop = Lview->Top(); 437 // // int newTop = Lview->Top();
438 // // if(Lview->lastRow() > i) 438 // // if(Lview->lastRow() > i)
439 // Lview->ScrollUp(1); 439 // Lview->ScrollUp(1);
440 // // i_pageNum++; 440 // // i_pageNum++;
441 // setStatus(); 441 // setStatus();
442 // Lview->setCursorPosition( Lview->Top(), 0, FALSE); 442 // Lview->setCursorPosition( Lview->Top(), 0, FALSE);
443 443
444 // } 444 // }
445 445
446 } 446 }
447 Lview->setFocus(); 447 Lview->setFocus();
448 448
449 odebug << "page number " << i_pageNum << " line number " << currentLine << "" << oendl; 449 odebug << "page number " << i_pageNum << " line number " << currentLine << "" << oendl;
450} 450}
451 451
452 452
453void Gutenbrowser::BackBtn() { 453void Gutenbrowser::BackBtn() {
454 if( i_pageNum > 0) { 454 if( i_pageNum > 0) {
455 int pageSize= Lview->PageSize(); 455 int pageSize= Lview->PageSize();
456 // int length=Lview->length(); 456 // int length=Lview->length();
457 457
458 i_pageNum--; 458 i_pageNum--;
459 currentFilePos = f.at(); 459 currentFilePos = f.at();
460 460
461 odebug << currentFilePos << " move back to " << pageStopArray[i_pageNum - 1 ] 461 odebug << currentFilePos << " move back to " << pageStopArray[i_pageNum - 1 ]
462 << ", current page number " << i_pageNum 462 << ", current page number " << i_pageNum
463 << ", " << pageSize << ", length " << Lview->length() << oendl; 463 << ", " << pageSize << ", length " << Lview->length() << oendl;
464 464
465 if( i_pageNum < 2) { 465 if( i_pageNum < 2) {
466 f.at( 0); 466 f.at( 0);
467 } else { 467 } else {
468 if(!f.at( pageStopArray[i_pageNum - 1] )) 468 if(!f.at( pageStopArray[i_pageNum - 1] ))
469 odebug << "File positioned backward did not work" << oendl; 469 odebug << "File positioned backward did not work" << oendl;
470 } 470 }
471 QString s; 471 QString s;
472 // int sizeLine=0; 472 // int sizeLine=0;
473 Lview->clear(); 473 Lview->clear();
474 // QString insertString; 474 // QString insertString;
475 475
476 for(int fd = 0; fd < pageSize ;fd++) { 476 for(int fd = 0; fd < pageSize ;fd++) {
477 // Lview->removeLine( Lview->PageSize() ); 477 // Lview->removeLine( Lview->PageSize() );
478 f.readLine(s, 256); 478 f.readLine(s, 256);
479 if(useWrap) 479 if(useWrap)
480 s.replace(QRegExp("\n"),""); 480 s.replace(QRegExp("\n"),"");
481 currentLine++; 481 currentLine++;
482 // insertString+=s; 482 // insertString+=s;
483 Lview->insertLine( s, -1); 483 Lview->insertLine( s, -1);
484 } 484 }
485 485
486 // Lview->insertAt( insertString,0,0, FALSE); 486 // Lview->insertAt( insertString,0,0, FALSE);
487 487
488 if( !BackButton->autoRepeat() && !BackButton->isDown()) { 488 if( !BackButton->autoRepeat() && !BackButton->isDown()) {
489 QString topR; 489 QString topR;
490 QString lastR; 490 QString lastR;
491 QString pageR; 491 QString pageR;
492 // int sizer = Lview->lastRow() - Lview->topRow(); 492 // int sizer = Lview->lastRow() - Lview->topRow();
493 // int i_topRow = Lview->topRow(); 493 // int i_topRow = Lview->topRow();
494 if( i_pageNum < 1) 494 if( i_pageNum < 1)
495 i_pageNum = 1; 495 i_pageNum = 1;
496 setCaption(QString::number(i_pageNum)); 496 setCaption(QString::number(i_pageNum));
497 } else { 497 } else {
498 // int newTop = Lview->Top(); 498 // int newTop = Lview->Top();
499 // if(Lview->lastRow() > i) 499 // if(Lview->lastRow() > i)
500 Lview->MultiLine_Ex::pageUp( FALSE); 500 Lview->MultiLine_Ex::pageUp( FALSE);
501 // Lview->ScrollDown(1); 501 // Lview->ScrollDown(1);
502 // i_pageNum--; 502 // i_pageNum--;
503 if( i_pageNum < 1) 503 if( i_pageNum < 1)
504 i_pageNum = 1; 504 i_pageNum = 1;
505 setStatus(); 505 setStatus();
506// Lview->setCursorPosition( Lview->Top(), 0, FALSE); 506// Lview->setCursorPosition( Lview->Top(), 0, FALSE);
507 507
508 } 508 }
509 } 509 }
510 Lview->setFocus(); 510 Lview->setFocus();
511} 511}
512 512
513void Gutenbrowser::doBeginBtn() { 513void Gutenbrowser::doBeginBtn() {
514 if(loadCheck) { 514 if(loadCheck) {
515 qApp->processEvents(); 515 qApp->processEvents();
516 BeginBtn(); 516 BeginBtn();
517 } 517 }
518} 518}
519 519
520 // moves text to the very top = 0 520 // moves text to the very top = 0
521void Gutenbrowser::TopBtn() { 521void Gutenbrowser::TopBtn() {
522 522
523 if(loadCheck) { 523 if(loadCheck) {
524 if( i_pageNum != 0) { 524 if( i_pageNum != 0) {
525 odebug << "top" << oendl; 525 odebug << "top" << oendl;
526 qApp->processEvents(); 526 qApp->processEvents();
527 currentLine = 0; 527 currentLine = 0;
528 i_pageNum = 1; 528 i_pageNum = 1;
529 int pageSize = Lview->PageSize() ; 529 int pageSize = Lview->PageSize() ;
530 Lview->clear(); 530 Lview->clear();
531 QString s; 531 QString s;
532 f.at(0); 532 f.at(0);
533 for(int fd=0; fd < pageSize ;fd++) { 533 for(int fd=0; fd < pageSize ;fd++) {
534 f.readLine(s, 256); 534 f.readLine(s, 256);
535 if(useWrap) 535 if(useWrap)
536 s.replace(QRegExp("\n"),""); 536 s.replace(QRegExp("\n"),"");
537 Lview->insertLine(s ,-1); 537 Lview->insertLine(s ,-1);
538 currentLine++; 538 currentLine++;
539 } 539 }
540// Lview->setCursorPosition( 0,0, FALSE); 540// Lview->setCursorPosition( 0,0, FALSE);
541 i_pageNum=1; 541 i_pageNum=1;
542 setStatus(); 542 setStatus();
543 } 543 }
544 Lview->setFocus(); 544 Lview->setFocus();
545 } 545 }
546} 546}
547 547
548 //moves text to the start of the EText 548 //moves text to the start of the EText
549void Gutenbrowser::BeginBtn() { 549void Gutenbrowser::BeginBtn() {
550 i_pageNum = 1; 550 i_pageNum = 1;
551 currentLine = 0; 551 currentLine = 0;
552 QString s_pattern="*END*THE SMALL PRINT"; 552 QString s_pattern="*END*THE SMALL PRINT";
553 QString sPattern2 = "*END THE SMALL PRINT"; 553 QString sPattern2 = "*END THE SMALL PRINT";
554 554
555 int pageSize = Lview->PageSize(); 555 int pageSize = Lview->PageSize();
556 Lview->clear(); 556 Lview->clear();
557 557
558 // int lines = Lview->numLines(); 558 // int lines = Lview->numLines();
559 int pos = 0;//, i = 0; 559 int pos = 0;//, i = 0;
560 int i_topRow = Lview->topRow(); 560 int i_topRow = Lview->topRow();
561 561
562 QString LeftText;// = Lview->text(); 562 QString LeftText;// = Lview->text();
563 563
564 int linesPerPage = Lview->lastRow() - Lview->topRow(); 564 // int linesPerPage = Lview->lastRow() - Lview->topRow();
565 // int pages = (( linesPerPage / Lview->editSize() ) ) +1; 565 // int pages = (( linesPerPage / Lview->editSize() ) ) +1;
566 // int pageN = 0; 566 // int pageN = 0;
567 i_pageNum = 1; 567 i_pageNum = 1;
568 int lastPage=1; 568 int lastPage=1;
569 int lineNo=0; 569 int lineNo=0;
570 QString s; 570 QString s;
571 f.at( 0); 571 f.at( 0);
572 572
573 while ( !f.atEnd() ) { 573 while ( !f.atEnd() ) {
574 f.readLine(s, 256); 574 f.readLine(s, 256);
575 lineNo++; 575 lineNo++;
576 LeftText = s; 576 LeftText = s;
577 currentFilePos = f.at(); 577 currentFilePos = f.at();
578 578
579 i_pageNum = lineNo/pageSize; 579 i_pageNum = lineNo/pageSize;
580 if(lastPage < i_pageNum) { 580 if(lastPage < i_pageNum) {
581 pageStopArray.resize(i_pageNum + 1); 581 pageStopArray.resize(i_pageNum + 1);
582 pageStopArray[i_pageNum ] = currentFilePos; 582 pageStopArray[i_pageNum ] = currentFilePos;
583 // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; 583 // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl;
584 } 584 }
585 // lastPage = i_pageNum; 585 // lastPage = i_pageNum;
586 if( LeftText.find( s_pattern, 0 , TRUE) != -1 || LeftText.find( sPattern2, 0 , TRUE) != -1 ) { 586 if( LeftText.find( s_pattern, 0 , TRUE) != -1 || LeftText.find( sPattern2, 0 , TRUE) != -1 ) {
587 odebug << "<<<<<< FOUND IT!! new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; 587 odebug << "<<<<<< FOUND IT!! new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl;
588 break; 588 break;
589 } 589 }
590 } 590 }
591 if(f.atEnd()) //in case we didnt find anything, we need to show something 591 if(f.atEnd()) //in case we didnt find anything, we need to show something
592 f.at(0); 592 f.at(0);
593 Lview->clear(); 593 Lview->clear();
594 for(int fd=0; fd < pageSize - 1;fd++) { 594 for(int fd=0; fd < pageSize - 1;fd++) {
595 f.readLine(s, 256); 595 f.readLine(s, 256);
596 if(useWrap) 596 if(useWrap)
597 s.replace(QRegExp("\n"),""); 597 s.replace(QRegExp("\n"),"");
598 Lview->insertLine( s, -1); 598 Lview->insertLine( s, -1);
599 currentLine++; 599 currentLine++;
600 } 600 }
601 601
602 i_pageNum = lineNo/pageSize; 602 i_pageNum = lineNo/pageSize;
603 pageStopArray.resize(i_pageNum + 1); 603 pageStopArray.resize(i_pageNum + 1);
604 // int length = Lview->length(); 604 // int length = Lview->length();
605 605
606 qApp->processEvents(); 606 qApp->processEvents();
607 607
608 if( pos > i_topRow ) { 608 if( pos > i_topRow ) {
609// Lview->setCursorPosition( pos+linesPerPage+2/* - i_topRow+3 */,0, FALSE); 609// Lview->setCursorPosition( pos+linesPerPage+2/* - i_topRow+3 */,0, FALSE);
610 } else { 610 } else {
611// Lview->setCursorPosition( pos+2 , 0, FALSE ); 611// Lview->setCursorPosition( pos+2 , 0, FALSE );
612 } 612 }
613 613
614 Lview->deselect(); 614 Lview->deselect();
615 // AdjustStatus(); 615 // AdjustStatus();
616 Lview->setFocus(); 616 Lview->setFocus();
617} 617}
618 618
619 /* 619 /*
620 sets the current page and place as a bookmark*/ 620 sets the current page and place as a bookmark*/
621void Gutenbrowser::setBookmark() { 621void Gutenbrowser::setBookmark() {
622 int eexit=QMessageBox::information(this, "Note", 622 int eexit=QMessageBox::information(this, "Note",
623 "Do you really want to \nset this bookmark?." 623 "Do you really want to \nset this bookmark?."
624 ,QMessageBox::Yes, QMessageBox::No); 624 ,QMessageBox::Yes, QMessageBox::No);
625 if (eexit== 3) { 625 if (eexit== 3) {
626 626
627 currentFilePos = f.at(); 627 currentFilePos = f.at();
628 628
629 Config cfg("Gutenbrowser"); 629 Config cfg("Gutenbrowser");
630 cfg.setGroup("General"); 630 cfg.setGroup("General");
631 file_name = cfg.readEntry("Current",""); 631 file_name = cfg.readEntry("Current","");
632 qApp->processEvents(); 632 qApp->processEvents();
633 odebug << "Setting book mark "+file_name << oendl; 633 odebug << "Setting book mark "+file_name << oendl;
634 634
635 cfg.setGroup("Titles"); 635 cfg.setGroup("Titles");
636 title = cfg.readEntry(file_name,""); 636 title = cfg.readEntry(file_name,"");
637 odebug << "title is "+ title << oendl; 637 odebug << "title is "+ title << oendl;
638 638
639 cfg.setGroup( "Bookmarks" ); 639 cfg.setGroup( "Bookmarks" );
640 640
641 cfg.writeEntry("File Name",file_name); 641 cfg.writeEntry("File Name",file_name);
642 cfg.writeEntry("Page Number",QString::number(i_pageNum) ); 642 cfg.writeEntry("Page Number",QString::number(i_pageNum) );
643 cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1])); 643 cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1]));
644 cfg.writeEntry("Title", title); 644 cfg.writeEntry("Title", title);
645 645
646 int row = Lview->topRow();// Lview->Top(); 646 int row = Lview->topRow();// Lview->Top();
647 cfg.writeEntry("LineNumber",QString::number(row) ); 647 cfg.writeEntry("LineNumber",QString::number(row) );
648 648
649 cfg.setGroup(title); 649 cfg.setGroup(title);
650 cfg.writeEntry("File Name",file_name); 650 cfg.writeEntry("File Name",file_name);
651 cfg.writeEntry( "LineNumber", QString::number( row)); 651 cfg.writeEntry( "LineNumber", QString::number( row));
652 cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1])); 652 cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1]));
653 cfg.writeEntry( "Page Number", QString::number( i_pageNum) ); 653 cfg.writeEntry( "Page Number", QString::number( i_pageNum) );
654 cfg.write(); 654 cfg.write();
655 bookmarksMenu->insertItem( title); 655 bookmarksMenu->insertItem( title);
656 } 656 }
657} //end setBookmark 657} //end setBookmark
658 658
659 659
660 /* goes to last set bookmark*/ 660 /* goes to last set bookmark*/
661void Gutenbrowser::Bookmark( int itemId) { 661void Gutenbrowser::Bookmark( int itemId) {
662 662
663 // qApp->processEvents(); 663 // qApp->processEvents();
664 Config config("Gutenbrowser"); 664 Config config("Gutenbrowser");
665 config.setGroup( "Bookmarks" ); 665 config.setGroup( "Bookmarks" );
666 666
667 odebug << "<<<<<< " << Lview->PageSize() << ", " << Lview->lastRow() - Lview->topRow() << "" << oendl; 667 odebug << "<<<<<< " << Lview->PageSize() << ", " << Lview->lastRow() - Lview->topRow() << "" << oendl;
668 668
669 QString itemString; 669 QString itemString;
670 670
671 odebug << "menu item " << itemId << "" << oendl; 671 odebug << "menu item " << itemId << "" << oendl;
672 QString tempTitle; 672 QString tempTitle;
673 QString s_Bmrkrow; 673 QString s_Bmrkrow;
674 QString s_pageNum; 674 QString s_pageNum;
675 int Bmrkrow=0; 675 int Bmrkrow=0;
676 int bookmarkPosition = 0; 676 int bookmarkPosition = 0;
677 677
678 // qApp->processEvents(); 678 // qApp->processEvents();
679 config.setGroup( "Bookmarks" ); 679 config.setGroup( "Bookmarks" );
680 title = config.readEntry("Title", ""); 680 title = config.readEntry("Title", "");
681 file_name = config.readEntry("File Name", ""); 681 file_name = config.readEntry("File Name", "");
682 i_pageNum = config.readNumEntry("Page Number", 0); 682 i_pageNum = config.readNumEntry("Page Number", 0);
683 bookmarkPosition = config.readNumEntry( "PagePosition",0); 683 bookmarkPosition = config.readNumEntry( "PagePosition",0);
684 Bmrkrow = config.readNumEntry("LineNumber",0); 684 Bmrkrow = config.readNumEntry("LineNumber",0);
685 if( !file_name.contains("/")) { 685 if( !file_name.contains("/")) {
686 file_name = local_library + file_name; 686 file_name = local_library + file_name;
687 } 687 }
688 688
689 // getTitle(file_name); 689 // getTitle(file_name);
690 // qApp->processEvents(); 690 // qApp->processEvents();
691 // Lview->setFocus(); 691 // Lview->setFocus();
692 this->setFocus(); 692 this->setFocus();
693 693
694 Lview->clear(); 694 Lview->clear();
695 695
696 if(!load(file_name)) return; 696 if(!load(file_name)) return;
697 697
698 int pageSize = Lview->PageSize(); 698 int pageSize = Lview->PageSize();
699 f.at(0); 699 f.at(0);
700 // Lview->clear(); 700 // Lview->clear();
701 QString s; 701 QString s;
702 int lineNo=0; 702 int lineNo=0;
703 int lastPage=1; 703 int lastPage=1;
704 while ( !f.atEnd() ) { 704 while ( !f.atEnd() ) {
705 f.readLine(s, 256); 705 f.readLine(s, 256);
706 lineNo++; 706 lineNo++;
707 currentFilePos = f.at(); 707 currentFilePos = f.at();
708 708
709 i_pageNum = lineNo/pageSize; 709 i_pageNum = lineNo/pageSize;
710 if(lastPage < i_pageNum) { 710 if(lastPage < i_pageNum) {
711 pageStopArray.resize(i_pageNum + 1); 711 pageStopArray.resize(i_pageNum + 1);
712 pageStopArray[i_pageNum ] = currentFilePos; 712 pageStopArray[i_pageNum ] = currentFilePos;
713 // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; 713 // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl;
714 } 714 }
715 if(currentFilePos == bookmarkPosition) 715 if(currentFilePos == bookmarkPosition)
716 break; 716 break;
717 } 717 }
718 if(f.atEnd()) 718 if(f.atEnd())
719 f.at(0); 719 f.at(0);
720 else 720 else
721 f.at( bookmarkPosition); 721 f.at( bookmarkPosition);
722 722
723 for(int fd=0; fd < pageSize - 1;fd++) { 723 for(int fd=0; fd < pageSize - 1;fd++) {
724 f.readLine(s, 256); 724 f.readLine(s, 256);
725 lineNo++; 725 lineNo++;
726 if(useWrap) 726 if(useWrap)
727 s.replace(QRegExp("\n"),""); 727 s.replace(QRegExp("\n"),"");
728 Lview->insertLine( s, -1); 728 Lview->insertLine( s, -1);
729 currentLine++; 729 currentLine++;
730 } 730 }
731 731
732 i_pageNum = lineNo/pageSize; 732 i_pageNum = lineNo/pageSize;
733 pageStopArray.resize(i_pageNum + 1); 733 pageStopArray.resize(i_pageNum + 1);
734 734
735 if(showMainList) { 735 if(showMainList) {
736 showMainList=FALSE; 736 showMainList=FALSE;
737 mainList->hide(); 737 mainList->hide();
738 Lview->show(); 738 Lview->show();
739 // qApp->processEvents(); 739 // qApp->processEvents();
740 } 740 }
741 741
742 odebug << "bookmark loaded" << oendl; 742 odebug << "bookmark loaded" << oendl;
743 setCaption(title); 743 setCaption(title);
744} 744}
745 745
746 746
747bool Gutenbrowser::load( const char *fileName) { 747bool Gutenbrowser::load( const char *fileName) {
748 748
749 // QCopEnvelope ( "QPE/System", "busy()" ); 749 // QCopEnvelope ( "QPE/System", "busy()" );
750 odebug << "Title is already set as "+title << oendl; 750 odebug << "Title is already set as "+title << oendl;
751 odebug << "sizeHint " << sizeHint().height() << " pageSize " << Lview->PageSize() << "" << oendl; 751 odebug << "sizeHint " << sizeHint().height() << " pageSize " << Lview->PageSize() << "" << oendl;
752 // pointSize = Lview->fontInfo().pointSize(); 752 // pointSize = Lview->fontInfo().pointSize();
753 // odebug << "sizeHint " << sizeHint().height() << " point size " << pointSize << "" << oendl; 753 // odebug << "sizeHint " << sizeHint().height() << " point size " << pointSize << "" << oendl;
754 if( Lview->PageSize() < 4) { 754 if( Lview->PageSize() < 4) {
755 755
756 //Lview->setMaximumHeight( sizeHint().height() ); 756 //Lview->setMaximumHeight( sizeHint().height() );