summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/browserDialog.cpp9
-rw-r--r--noncore/apps/opie-gutenbrowser/config.in6
-rw-r--r--noncore/apps/opie-gutenbrowser/openetext.cpp35
-rw-r--r--noncore/apps/opie-gutenbrowser/opie-gutenbrowser.pro9
4 files changed, 32 insertions, 27 deletions
diff --git a/noncore/apps/opie-gutenbrowser/browserDialog.cpp b/noncore/apps/opie-gutenbrowser/browserDialog.cpp
index 5c48da1..81dd516 100644
--- a/noncore/apps/opie-gutenbrowser/browserDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/browserDialog.cpp
@@ -1,33 +1,36 @@
1/**************************************************************************** 1/****************************************************************************
2copyright 2001 by L.J. Potter ljp@llornkcor.com 2copyright 2001 by L.J. Potter ljp@llornkcor.com
3 copyright : (C) 2000 -2004 by llornkcor 3 copyright : (C) 2000 -2004 by llornkcor
4 email : ljp@llornkcor.com 4 email : ljp@llornkcor.com
5 5
6****************************************************************************/ 6****************************************************************************/
7 7
8#include "optionsDialog.h" 8#include "optionsDialog.h"
9//#include "fileBrowser.h" 9//#include "fileBrowser.h"
10 10
11/* OPIE */
12#include <opie2/ofiledialog.h>
13using namespace Opie::Ui;
14
15/* QT */
11#include <qlabel.h> 16#include <qlabel.h>
12#include <qlistbox.h> 17#include <qlistbox.h>
13#include <qpushbutton.h> 18#include <qpushbutton.h>
14#include <qlayout.h> 19#include <qlayout.h>
15 20
16#include <opie/ofiledialog.h>
17
18void optionsDialog::BrowserDlg( ) 21void optionsDialog::BrowserDlg( )
19{ 22{
20// setCaption( tr( "Choose Browser" ) ); 23// setCaption( tr( "Choose Browser" ) );
21 http_ListBox1->insertItem( tr( "Opera")); 24 http_ListBox1->insertItem( tr( "Opera"));
22 http_ListBox1->insertItem( tr( "Konqueror")); 25 http_ListBox1->insertItem( tr( "Konqueror"));
23 http_ListBox1->insertItem( tr( "wget")); 26 http_ListBox1->insertItem( tr( "wget"));
24} 27}
25 28
26void optionsDialog::select_title(int) { 29void optionsDialog::select_title(int) {
27 browserName = http_ListBox1->currentText(); 30 browserName = http_ListBox1->currentText();
28 Config config("Gutenbrowser"); 31 Config config("Gutenbrowser");
29 config.setGroup( "Browser" ); 32 config.setGroup( "Browser" );
30 printf("Brow is: "+browserName+"\n"); 33 printf("Brow is: "+browserName+"\n");
31 config.writeEntry("Preferred", browserName); 34 config.writeEntry("Preferred", browserName);
32 TextLabel3_3->setText( "Current http browser: "+browserName ); 35 TextLabel3_3->setText( "Current http browser: "+browserName );
33} 36}
@@ -58,26 +61,26 @@ void optionsDialog::BrowseSelected() {
58// fileTemp.right( fileTemp.length()-5); 61// fileTemp.right( fileTemp.length()-5);
59// fileName = fileTemp; 62// fileName = fileTemp;
60// if( !fileName.isEmpty() ){ 63// if( !fileName.isEmpty() ){
61// filer = fileName; 64// filer = fileName;
62// } else { 65// } else {
63// QString sMsg; 66// QString sMsg;
64// sMsg = "Error opening library filelist "+fileName; 67// sMsg = "Error opening library filelist "+fileName;
65// } 68// }
66 if ( !fileName.isNull() ) { // got a file name 69 if ( !fileName.isNull() ) { // got a file name
67 // ... 70 // ...
68 } 71 }
69 } 72 }
70 73
71} 74}
72 75
73void optionsDialog::setHttp(int index) { 76void optionsDialog::setHttp(int index) {
74 Config config("Gutenbrowser"); 77 Config config("Gutenbrowser");
75 config.setGroup( "HttpServer" ); 78 config.setGroup( "HttpServer" );
76 qDebug("writing http server"); 79 qDebug("writing http server");
77 if( index== 0) { 80 if( index== 0) {
78 config.writeEntry("Preferred", "http://sailor.gutenberg.org"); 81 config.writeEntry("Preferred", "http://sailor.gutenberg.org");
79 } else { 82 } else {
80 config.writeEntry("Preferred", "http://www.prairienet.org/pg"); 83 config.writeEntry("Preferred", "http://www.prairienet.org/pg");
81 } 84 }
82 85
83} 86}
diff --git a/noncore/apps/opie-gutenbrowser/config.in b/noncore/apps/opie-gutenbrowser/config.in
index ec67d6e..d2a3033 100644
--- a/noncore/apps/opie-gutenbrowser/config.in
+++ b/noncore/apps/opie-gutenbrowser/config.in
@@ -1,4 +1,6 @@
1 config OPIE-GUTENBROWSER 1 config GUTENBROWSER
2 boolean "gutenbrowser - Gutenberg Project etext reader and selector" 2 boolean "gutenbrowser - Gutenberg Project etext reader and selector"
3 default "n" 3 default "n"
4 depends ( LIBQPE || LIBQPE-X11 ) && FTPLIB 4 depends ( LIBQPE || LIBQPE-X11 ) && FTPLIB && LIBOPIE2CORE && LIBOPIE2UI
5 comment "gutenbrowser needs a libqpe, ftplib, libopie2core and libopie2ui"
6 depends !(( LIBQPE || LIBQPE-X11 ) && FTPLIB && LIBOPIE2CORE && LIBOPIE2UI)
diff --git a/noncore/apps/opie-gutenbrowser/openetext.cpp b/noncore/apps/opie-gutenbrowser/openetext.cpp
index 40f35d6..bd44ce6 100644
--- a/noncore/apps/opie-gutenbrowser/openetext.cpp
+++ b/noncore/apps/opie-gutenbrowser/openetext.cpp
@@ -3,41 +3,42 @@
3 begin : Sat Dec 4 1999 3 begin : Sat Dec 4 1999
4 begin : Tue Jul 25 2000 4 begin : Tue Jul 25 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 "gutenbrowser.h" 15#include "gutenbrowser.h"
16#include "openetext.h" 16#include "openetext.h"
17#include "editTitle.h" 17#include "editTitle.h"
18 18
19#include <qfileinfo.h> 19/* OPIE */
20#include <opie2/ofiledialog.h>
20#include <qpe/applnk.h> 21#include <qpe/applnk.h>
22#include <qpe/config.h>
21#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24using namespace Opie::Ui;
22 25
23#include <stdlib.h> 26#include <stdlib.h>
24#include <qtextstream.h> 27#include <qtextstream.h>
25#include <qpe/config.h> 28#include <qfileinfo.h>
26
27#include <opie/ofiledialog.h>
28 29
29#if defined(_WS_WIN_) 30#if defined(_WS_WIN_)
30#include <windows.h> 31#include <windows.h>
31#else 32#else
32#include <unistd.h> 33#include <unistd.h>
33#include "sys/stat.h" 34#include "sys/stat.h"
34#endif 35#endif
35 36
36OpenEtext::OpenEtext(QWidget *parent, QString name) : QDialog(parent,name,true) 37OpenEtext::OpenEtext(QWidget *parent, QString name) : QDialog(parent,name,true)
37{ 38{
38 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; 39 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
39 local_index=local_library+"GUTINDEX.ALL"; 40 local_index=local_library+"GUTINDEX.ALL";
40 initDialog(); 41 initDialog();
41 connect( QListBox_1, SIGNAL(selected ( int)),this, SLOT(select_title(int)) ); 42 connect( QListBox_1, SIGNAL(selected ( int)),this, SLOT(select_title(int)) );
42 43
43 getTitles(); 44 getTitles();
@@ -136,65 +137,65 @@ OpenFileButton->setDown(TRUE);
136 qDebug("Open file: "+str); 137 qDebug("Open file: "+str);
137 138
138 // QStringList::ConstIterator f; 139 // QStringList::ConstIterator f;
139// QString fileTemp; 140// QString fileTemp;
140// for ( f = fileList.begin(); f != fileList.end(); f++ ) { 141// for ( f = fileList.begin(); f != fileList.end(); f++ ) {
141// fileTemp = *f; 142// fileTemp = *f;
142// fileTemp.right( fileTemp.length()-5); 143// fileTemp.right( fileTemp.length()-5);
143// fileName = fileTemp; 144// fileName = fileTemp;
144// if( !fileName.isEmpty() ){ 145// if( !fileName.isEmpty() ){
145// filer = fileName; 146// filer = fileName;
146// } else { //filename is empty 147// } else { //filename is empty
147// // QString sMsg; 148// // QString sMsg;
148// // sMsg = "Error opening library filelist "+fileName; 149// // sMsg = "Error opening library filelist "+fileName;
149// } 150// }
150 151
151 if( filer.right(4) == ".txt" 152 if( filer.right(4) == ".txt"
152 || filer.right(4) == ".TXT" 153 || filer.right(4) == ".TXT"
153 || filer.right(4) == ".etx" 154 || filer.right(4) == ".etx"
154 || filer.right(4) == ".ETX" 155 || filer.right(4) == ".ETX"
155 || filer.right(4) == ".etx" 156 || filer.right(4) == ".etx"
156 || filer.right(4) == ".ETX" 157 || filer.right(4) == ".ETX"
157 || filer.right(4) == ".zip" 158 || filer.right(4) == ".zip"
158 || filer.right(4) == ".ZIP" ) { 159 || filer.right(4) == ".ZIP" ) {
159 QFileInfo zipFile( filer); 160 QFileInfo zipFile( filer);
160 QString s_fileName = zipFile.fileName(); 161 QString s_fileName = zipFile.fileName();
161 QString cmd; 162 QString cmd;
162 163
163 if( s_fileName.right(4) == ".zip") { // unzip that sucker.... 164 if( s_fileName.right(4) == ".zip") { // unzip that sucker....
164 s_fileName = s_fileName.left( s_fileName.length() - 4); 165 s_fileName = s_fileName.left( s_fileName.length() - 4);
165 if( chdir((const char*)local_library.latin1())!=0) 166 if( chdir((const char*)local_library.latin1())!=0)
166 qDebug("chdir failed.");// QString cmd = "gunzip -d " + filer + " -d " + local_library; 167 qDebug("chdir failed.");// QString cmd = "gunzip -d " + filer + " -d " + local_library;
167 cmd = "gunzip -S .zip " + filer; 168 cmd = "gunzip -S .zip " + filer;
168 fileName = local_library + s_fileName + ".txt"; 169 fileName = local_library + s_fileName + ".txt";
169 system( cmd); 170 system( cmd);
170 } 171 }
171// this renames the .txt to .etx!! 172// this renames the .txt to .etx!!
172 else /*if( s_fileName.right(4) == ".txt" || if( s_fileName.right(4) == ".TXT"))*/ { 173 else /*if( s_fileName.right(4) == ".txt" || if( s_fileName.right(4) == ".TXT"))*/ {
173// qDebug("Filename is "+fileName); 174// qDebug("Filename is "+fileName);
174 s_fileName = fileName; 175 s_fileName = fileName;
175 s_fileName.replace( s_fileName.length()-3,3,"gtn");// s_fileName.replace( s_fileName.length()-3,3,"etx"); 176 s_fileName.replace( s_fileName.length()-3,3,"gtn");// s_fileName.replace( s_fileName.length()-3,3,"etx");
176 rename(fileName.latin1(),s_fileName.latin1()); 177 rename(fileName.latin1(),s_fileName.latin1());
177 fileName = s_fileName; 178 fileName = s_fileName;
178// qDebug("Filename is now "+fileName); 179// qDebug("Filename is now "+fileName);
179 } 180 }
180 } else 181 } else
181 fileName = str; 182 fileName = str;
182 183
183 FindTitle(fileName); 184 FindTitle(fileName);
184 185
185 QFileInfo fi( fileName); 186 QFileInfo fi( fileName);
186 name_file = fi.fileName(); 187 name_file = fi.fileName();
187 name_file = name_file.left(name_file.length() - 4); 188 name_file = name_file.left(name_file.length() - 4);
188 189
189 qDebug("Setting doclink"); 190 qDebug("Setting doclink");
190 DocLnk lnk; 191 DocLnk lnk;
191 qDebug("name is " + name_file); 192 qDebug("name is " + name_file);
192 lnk.setName(name_file); //sets file name 193 lnk.setName(name_file); //sets file name
193 qDebug("Title is "+title); 194 qDebug("Title is "+title);
194 lnk.setComment(title); 195 lnk.setComment(title);
195 196
196 QListBox_1->clear(); 197 QListBox_1->clear();
197 getTitles(); 198 getTitles();
198 qDebug("Filename is "+fileName); 199 qDebug("Filename is "+fileName);
199 lnk.setFile(fileName); //sets File property 200 lnk.setFile(fileName); //sets File property
200 lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D 201 lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D
@@ -211,33 +212,33 @@ OpenFileButton->setDown(TRUE);
211find the title in the config file */ 212find the title in the config file */
212bool OpenEtext::FindTitle( QString filename) 213bool OpenEtext::FindTitle( QString filename)
213{ 214{
214 Config config("Gutenbrowser"); 215 Config config("Gutenbrowser");
215 config.setGroup( "Files" ); 216 config.setGroup( "Files" );
216 QString s_numofFiles = config.readEntry("NumberOfFiles", "0"); 217 QString s_numofFiles = config.readEntry("NumberOfFiles", "0");
217 int i_numofFiles = s_numofFiles.toInt(); 218 int i_numofFiles = s_numofFiles.toInt();
218 219
219 QFileInfo fi(filename); 220 QFileInfo fi(filename);
220 name = fi.fileName(); 221 name = fi.fileName();
221 qDebug("filename to open is " + name); 222 qDebug("filename to open is " + name);
222 QFile indexLib( filename); 223 QFile indexLib( filename);
223 bool findCheck = FALSE; 224 bool findCheck = FALSE;
224 // int Titlenumber=0; 225 // int Titlenumber=0;
225 226
226 if ( indexLib.open( IO_ReadOnly) ) { 227 if ( indexLib.open( IO_ReadOnly) ) {
227 qDebug("file opened successfully"); 228 qDebug("file opened successfully");
228 QTextStream indexStream( &indexLib ); 229 QTextStream indexStream( &indexLib );
229 QString target = "Project Gutenberg Etext of"; 230 QString target = "Project Gutenberg Etext of";
230 QString target2 = "Project Gutenberg Etext"; 231 QString target2 = "Project Gutenberg Etext";
231 QString target3 = "Project Gutenberg's Etext of"; 232 QString target3 = "Project Gutenberg's Etext of";
232 QString target4 = "Project Gutenberg's Etext"; 233 QString target4 = "Project Gutenberg's Etext";
233 QString indexLine; 234 QString indexLine;
234 while ( !indexStream.eof() ) { 235 while ( !indexStream.eof() ) {
235 // until end of file.. 236 // until end of file..
236 indexLine = indexStream.readLine(); 237 indexLine = indexStream.readLine();
237 if( indexLine.find(target, 0, TRUE) > -1 && !findCheck) {findCheck = TRUE; 238 if( indexLine.find(target, 0, TRUE) > -1 && !findCheck) {findCheck = TRUE;
238 title = indexLine.mid( indexLine.find(target, 0, TRUE) + (target.length()) , indexLine.find("\r", 0, TRUE)); 239 title = indexLine.mid( indexLine.find(target, 0, TRUE) + (target.length()) , indexLine.find("\r", 0, TRUE));
239 title = title.left( title.find( "*",0, TRUE)); 240 title = title.left( title.find( "*",0, TRUE));
240 title = title.stripWhiteSpace (); 241 title = title.stripWhiteSpace ();
241// qDebug("Found the title 1 and it is %s", title.latin1()); 242// qDebug("Found the title 1 and it is %s", title.latin1());
242// QListBox_1->insertItem ( title); 243// QListBox_1->insertItem ( title);
243 } 244 }
@@ -251,34 +252,34 @@ bool OpenEtext::FindTitle( QString filename)
251 } 252 }
252 if( indexLine.find( target3, 0, TRUE) > -1 && !findCheck) { 253 if( indexLine.find( target3, 0, TRUE) > -1 && !findCheck) {
253 findCheck = TRUE; 254 findCheck = TRUE;
254 title = indexLine.mid( indexLine.find( target3, 0, TRUE) + ( target3.length()) , indexLine.find("\r", 0, TRUE)); 255 title = indexLine.mid( indexLine.find( target3, 0, TRUE) + ( target3.length()) , indexLine.find("\r", 0, TRUE));
255 title = title.left( title.find( "*",0, TRUE)); 256 title = title.left( title.find( "*",0, TRUE));
256 title = title.stripWhiteSpace (); 257 title = title.stripWhiteSpace ();
257// qDebug("Found the title 3 and it is %s", title.latin1()); 258// qDebug("Found the title 3 and it is %s", title.latin1());
258 } 259 }
259 if( indexLine.find( target4, 0, TRUE) > -1 && !findCheck) { 260 if( indexLine.find( target4, 0, TRUE) > -1 && !findCheck) {
260 findCheck = TRUE; 261 findCheck = TRUE;
261 title = indexLine.mid( indexLine.find( target4, 0, TRUE) + ( target4.length()) , indexLine.find("\r", 0, TRUE)); 262 title = indexLine.mid( indexLine.find( target4, 0, TRUE) + ( target4.length()) , indexLine.find("\r", 0, TRUE));
262 title = title.left( title.find( "*",0, TRUE)); 263 title = title.left( title.find( "*",0, TRUE));
263 title = title.stripWhiteSpace (); 264 title = title.stripWhiteSpace ();
264// qDebug("Found the title 4 and it is %s", title.latin1()); 265// qDebug("Found the title 4 and it is %s", title.latin1());
265 } 266 }
266 } //endof file 267 } //endof file
267 indexLib.close(); 268 indexLib.close();
268 269
269 if( !findCheck || title.length() < 2) { 270 if( !findCheck || title.length() < 2) {
270 qDebug("Trying hard to find title from GUTINDEX.ALL"); 271 qDebug("Trying hard to find title from GUTINDEX.ALL");
271 title = titleFromLibrary( filename); 272 title = titleFromLibrary( filename);
272 findCheck = TRUE; 273 findCheck = TRUE;
273 } 274 }
274 275
275 if ( checkConf() == false && findCheck == TRUE) { 276 if ( checkConf() == false && findCheck == TRUE) {
276 277
277 config.setGroup( "Files"); 278 config.setGroup( "Files");
278 config.writeEntry("NumberOfFiles",i_numofFiles + 1 ); 279 config.writeEntry("NumberOfFiles",i_numofFiles + 1 );
279 QString interger; 280 QString interger;
280 interger.setNum( i_numofFiles +1); 281 interger.setNum( i_numofFiles +1);
281 config.writeEntry(interger, filename); 282 config.writeEntry(interger, filename);
282 config.setGroup( "Titles" ); 283 config.setGroup( "Titles" );
283 for (int i = 1; i <= i_numofFiles; i++) { //find dup titles in config file 284 for (int i = 1; i <= i_numofFiles; i++) { //find dup titles in config file
284 QString temp; 285 QString temp;
diff --git a/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.pro b/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.pro
index e34e922..5c1d0c4 100644
--- a/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.pro
+++ b/noncore/apps/opie-gutenbrowser/opie-gutenbrowser.pro
@@ -1,45 +1,44 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG += qt warn_on release quick-app 2CONFIG += qt warn_on quick-app
3#CONFIG += qt warn_on release qpp
4HEADERS = LibraryDialog.h \ 3HEADERS = LibraryDialog.h \
5 SearchDialog.h \ 4 SearchDialog.h \
6 SearchResults.h \ 5 SearchResults.h \
7 helpme.h \ 6 helpme.h \
8 multiline_ex.h \ 7 multiline_ex.h \
9 openetext.h \ 8 openetext.h \
10 editTitle.h \ 9 editTitle.h \
11 fontDialog.h \ 10 fontDialog.h \
12 optionsDialog.h \ 11 optionsDialog.h \
13 helpwindow.h \ 12 helpwindow.h \
14 output.h \ 13 output.h \
15 NetworkDialog.h \ 14 NetworkDialog.h \
16 gutenbrowser.h \ 15 gutenbrowser.h \
17 resource.h 16 resource.h
18SOURCES = LibraryDialog.cpp \ 17SOURCES = LibraryDialog.cpp \
19 LibraryDialogData.cpp \ 18 LibraryDialogData.cpp \
20 SearchDialog.cpp \ 19 SearchDialog.cpp \
21 SearchResults.cpp \ 20 SearchResults.cpp \
22 browserDialog.cpp \ 21 browserDialog.cpp \
23 helpme.cpp \ 22 helpme.cpp \
24 multiline_ex.cpp \ 23 multiline_ex.cpp \
25 fontDialog.cpp \ 24 fontDialog.cpp \
26 openetext.cpp \ 25 openetext.cpp \
27 openetextdata.cpp \ 26 openetextdata.cpp \
28 editTitle.cpp \ 27 editTitle.cpp \
29 ftpsitedlg.cpp \ 28 ftpsitedlg.cpp \
30 optionsDialog.cpp \ 29 optionsDialog.cpp \
31 optionsDialogData.cpp \ 30 optionsDialogData.cpp \
32 helpwindow.cpp \ 31 helpwindow.cpp \
33 output.cpp \ 32 output.cpp \
34 NetworkDialog.cpp \ 33 NetworkDialog.cpp \
35 gutenbrowserData.cpp \ 34 gutenbrowserData.cpp \
36 gutenbrowser.cpp \ 35 gutenbrowser.cpp \
37 main.cpp 36 main.cpp
38TARGET = gutenbrowser 37TARGET = gutenbrowser
39 38
40INCLUDEPATH += $(OPIEDIR)/include 39INCLUDEPATH += $(OPIEDIR)/include
41DEPENDPATH += $(OPIEDIR)/include 40DEPENDPATH += $(OPIEDIR)/include
42DESTDIR = $(OPIEDIR)/bin 41DESTDIR = $(OPIEDIR)/bin
43LIBS += -lqpe -lpthread -lftplib -lopie 42LIBS += -lqpe -lpthread -lftplib -lopiecore2 -lopieui2
44 43
45include ( $(OPIEDIR)/include.pro ) 44include ( $(OPIEDIR)/include.pro )