Diffstat (limited to 'noncore/apps/opie-gutenbrowser') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | 1724 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/NetworkDialog.cpp | 78 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/SearchDialog.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/browserDialog.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/fontDialog.cpp | 20 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp | 33 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowser.cpp | 3217 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp | 38 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/helpme.cpp | 13 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/main.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/openetext.cpp | 55 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/optionsDialog.cpp | 42 |
12 files changed, 2636 insertions, 2595 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp index 5b22b00..270a4cf 100644 --- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | |||
@@ -15,2 +15,6 @@ | |||
15 | 15 | ||
16 | #include "LibraryDialog.h" | ||
17 | #include "output.h" | ||
18 | |||
19 | /* OPIE */ | ||
16 | #include <qpe/applnk.h> | 20 | #include <qpe/applnk.h> |
@@ -18,6 +22,5 @@ | |||
18 | #include <qpe/qpedialog.h> | 22 | #include <qpe/qpedialog.h> |
23 | #include <opie2/odebug.h> | ||
19 | 24 | ||
20 | #include "LibraryDialog.h" | 25 | /* QT */ |
21 | #include "output.h" | ||
22 | |||
23 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
@@ -26,2 +29,3 @@ | |||
26 | 29 | ||
30 | /* STD */ | ||
27 | #include <unistd.h> | 31 | #include <unistd.h> |
@@ -34,8 +38,8 @@ | |||
34 | LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, WFlags fl ) | 38 | LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, WFlags fl ) |
35 | : QDialog( parent, name, true/* modal*/, fl ) | 39 | : QDialog( parent, name, true/* modal*/, fl ) |
36 | { | 40 | { |
37 | if ( !name ) | 41 | if ( !name ) |
38 | setName( "LibraryDialog" ); | 42 | setName( "LibraryDialog" ); |
39 | indexLoaded=false; | 43 | indexLoaded=false; |
40 | initDialog(); | 44 | initDialog(); |
41 | 45 | ||
@@ -43,43 +47,43 @@ LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, W | |||
43 | 47 | ||
44 | index = "GUTINDEX.ALL"; | 48 | index = "GUTINDEX.ALL"; |
45 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; | 49 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; |
46 | local_index = local_library + index; | 50 | local_index = local_library + index; |
47 | 51 | ||
48 | QString iniFile ; | 52 | QString iniFile ; |
49 | iniFile = QPEApplication::qpeDir()+"/etc/gutenbrowser/gutenbrowserrc"; | 53 | iniFile = QPEApplication::qpeDir()+"/etc/gutenbrowser/gutenbrowserrc"; |
50 | 54 | ||
51 | new_index =QPEApplication::qpeDir()+"/etc/gutenbrowser/PGWHOLE.TXT"; | 55 | new_index =QPEApplication::qpeDir()+"/etc/gutenbrowser/PGWHOLE.TXT"; |
52 | 56 | ||
53 | old_index = QPEApplication::qpeDir()+"/etc/gutenbrowser/GUTINDEX.ALL"; | 57 | old_index = QPEApplication::qpeDir()+"/etc/gutenbrowser/GUTINDEX.ALL"; |
54 | // old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; | 58 | // old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; |
55 | 59 | ||
56 | // iniFile = local_library+"gutenbrowserrc"; | 60 | // iniFile = local_library+"gutenbrowserrc"; |
57 | // new_index = local_library + "PGWHOLE.TXT"; | 61 | // new_index = local_library + "PGWHOLE.TXT"; |
58 | // old_index = local_library + "GUTINDEX.ALL"; | 62 | // old_index = local_library + "GUTINDEX.ALL"; |
59 | 63 | ||
60 | Config config("Gutenbrowser"); | 64 | Config config("Gutenbrowser"); |
61 | 65 | ||
62 | config.setGroup( "HttpServer" ); | 66 | config.setGroup( "HttpServer" ); |
63 | proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); | 67 | proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); |
64 | 68 | ||
65 | config.setGroup( "FTPsite" ); | 69 | config.setGroup( "FTPsite" ); |
66 | ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); | 70 | ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); |
67 | qDebug("Library Dialog: ftp_host is "+ftp_host); | 71 | odebug << "Library Dialog: ftp_host is "+ftp_host << oendl; |
68 | // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); | 72 | // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); |
69 | // ftp_host=ftp_host.stripWhiteSpace(); | 73 | // ftp_host=ftp_host.stripWhiteSpace(); |
70 | ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); | 74 | ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); |
71 | 75 | ||
72 | i_binary = 0; | 76 | i_binary = 0; |
73 | 77 | ||
74 | config.setGroup("SortAuth"); | 78 | config.setGroup("SortAuth"); |
75 | if( config.readEntry("authSort", "FALSE") == "TRUE") | 79 | if( config.readEntry("authSort", "FALSE") == "TRUE") |
76 | authBox->setChecked(TRUE); | 80 | authBox->setChecked(TRUE); |
77 | 81 | ||
78 | config.setGroup("General"); | 82 | config.setGroup("General"); |
79 | downDir =config.readEntry( "DownloadDirectory",local_library); | 83 | downDir =config.readEntry( "DownloadDirectory",local_library); |
80 | qDebug("downDir is "+downDir); | 84 | odebug << "downDir is "+downDir << oendl; |
81 | newindexLib.setName( old_index); | 85 | newindexLib.setName( old_index); |
82 | indexLib.setName( old_index); | 86 | indexLib.setName( old_index); |
83 | 87 | ||
84 | new QPEDialogListener(this); | 88 | new QPEDialogListener(this); |
85 | } | 89 | } |
@@ -88,9 +92,9 @@ LibraryDialog::~LibraryDialog() | |||
88 | { | 92 | { |
89 | // delete QList_Item2; | 93 | // delete QList_Item2; |
90 | // delete QList_Item1; | 94 | // delete QList_Item1; |
91 | // delete QList_Item3; | 95 | // delete QList_Item3; |
92 | // delete QList_Item4; | 96 | // delete QList_Item4; |
93 | // delete QList_Item5; | 97 | // delete QList_Item5; |
94 | 98 | ||
95 | //saveConfig(); | 99 | // saveConfig(); |
96 | } | 100 | } |
@@ -101,69 +105,69 @@ void LibraryDialog::Newlibrary() | |||
101 | #ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files | 105 | #ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files |
102 | //qDebug("Opening new library index %s",newindexLib); | 106 | //odebug << "Opening new library index " << newindexLib << "" << oendl; |
103 | if ( newindexLib.open( IO_ReadOnly) ) { | 107 | if ( newindexLib.open( IO_ReadOnly) ) { |
104 | setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully | 108 | setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully |
105 | QTextStream indexStream( &newindexLib ); | 109 | QTextStream indexStream( &newindexLib ); |
106 | QString indexLine; | 110 | QString indexLine; |
107 | while ( !indexStream.atEnd() ) { // until end of file.. | 111 | while ( !indexStream.atEnd() ) { // until end of file.. |
108 | indexLine = indexStream.readLine(); | 112 | indexLine = indexStream.readLine(); |
109 | if ( ( indexLine.mid(4,4)).toInt() && !( indexLine.left(3)).toInt()) { | 113 | if ( ( indexLine.mid(4,4)).toInt() && !( indexLine.left(3)).toInt()) { |
110 | year = indexLine.mid(4,4); | 114 | year = indexLine.mid(4,4); |
111 | year = year.stripWhiteSpace(); | 115 | year = year.stripWhiteSpace(); |
112 | file = indexLine.mid( indexLine.find( "[", 0, TRUE )+1, 12 ); | 116 | file = indexLine.mid( indexLine.find( "[", 0, TRUE )+1, 12 ); |
113 | file = file.stripWhiteSpace(); | 117 | file = file.stripWhiteSpace(); |
114 | number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); | 118 | number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); |
115 | if( year.toInt() < 1984) | 119 | if( year.toInt() < 1984) |
116 | number = number.left( number.length() -1 ); | 120 | number = number.left( number.length() -1 ); |
117 | number = number.stripWhiteSpace(); | 121 | number = number.stripWhiteSpace(); |
118 | title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); | 122 | title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); |
119 | title = title.stripWhiteSpace(); | 123 | title = title.stripWhiteSpace(); |
120 | 124 | ||
121 | getAuthor(); // groks author | 125 | getAuthor(); // groks author |
122 | author = author.stripWhiteSpace(); | 126 | author = author.stripWhiteSpace(); |
123 | if (authBox->isChecked()) { // this reverses the first name and last name of the author | 127 | if (authBox->isChecked()) { // this reverses the first name and last name of the author |
124 | // qDebug("Sorting last name first"); | 128 | // odebug << "Sorting last name first" << oendl; |
125 | QString lastName, firstName=""; | 129 | QString lastName, firstName=""; |
126 | int finder=author.findRev( ' ', -1, TRUE); | 130 | int finder=author.findRev( ' ', -1, TRUE); |
127 | lastName=author.right( author.length()-finder); | 131 | lastName=author.right( author.length()-finder); |
128 | firstName=author.left(finder); | 132 | firstName=author.left(finder); |
129 | lastName=lastName.stripWhiteSpace(); | 133 | lastName=lastName.stripWhiteSpace(); |
130 | firstName=firstName.stripWhiteSpace(); | 134 | firstName=firstName.stripWhiteSpace(); |
131 | 135 | ||
132 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names | 136 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names |
133 | author=lastName+", "+firstName; | 137 | author=lastName+", "+firstName; |
134 | } | 138 | } |
135 | 139 | ||
136 | if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) && (file.find( "]",0, TRUE) == -1) ) { | 140 | if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) && (file.find( "]",0, TRUE) == -1) ) { |
137 | 141 | ||
138 | // fill string list or something to be able to resort the whole library | 142 | // fill string list or something to be able to resort the whole library |
139 | if( author.isEmpty() ) | 143 | if( author.isEmpty() ) |
140 | QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file ); | 144 | QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file ); |
141 | else { | 145 | else { |
142 | 146 | ||
143 | if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || | 147 | if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || |
144 | (author.left(1) >= QString("a") && author.left(1) <= QString("f")) ) | 148 | (author.left(1) >= QString("a") && author.left(1) <= QString("f")) ) |
145 | QList_Item1 = new QListViewItem( ListView1,/* number,*/ title, author, year, file ); | 149 | QList_Item1 = new QListViewItem( ListView1,/* number,*/ title, author, year, file ); |
146 | 150 | ||
147 | else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) || | 151 | else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) || |
148 | (author.left(1) >= QString("g") && author.left(1) <= QString("m")) ) | 152 | (author.left(1) >= QString("g") && author.left(1) <= QString("m")) ) |
149 | QList_Item2 = new QListViewItem( ListView2, /*number, */title, author, year, file ); | 153 | QList_Item2 = new QListViewItem( ListView2, /*number, */title, author, year, file ); |
150 | 154 | ||
151 | else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) || | 155 | else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) || |
152 | (author.left(1) >= QString("n") && author.left(1) <= QString("r")) ) | 156 | (author.left(1) >= QString("n") && author.left(1) <= QString("r")) ) |
153 | QList_Item3 = new QListViewItem( ListView3, /*number,*/ title, author, year, file ); | 157 | QList_Item3 = new QListViewItem( ListView3, /*number,*/ title, author, year, file ); |
154 | 158 | ||
155 | else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) || | 159 | else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) || |
156 | (author.left(1) >= QString("s") && author.left(1) <= QString("z")) ) | 160 | (author.left(1) >= QString("s") && author.left(1) <= QString("z")) ) |
157 | QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file ); | 161 | QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file ); |
158 | 162 | ||
159 | else | 163 | else |
160 | QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file ); | 164 | QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file ); |
161 | } | 165 | } |
162 | } | 166 | } |
163 | }// end if | 167 | }// end if |
164 | }// end while | 168 | }// end while |
165 | newindexLib.close(); | 169 | newindexLib.close(); |
166 | } | 170 | } |
167 | #ifndef Q_WS_QWS | 171 | #ifndef Q_WS_QWS |
168 | setCursor( arrowCursor); | 172 | setCursor( arrowCursor); |
169 | #endif | 173 | #endif |
@@ -176,82 +180,82 @@ void LibraryDialog::Library() | |||
176 | 180 | ||
177 | ListView1->clear(); | 181 | ListView1->clear(); |
178 | ListView2->clear(); | 182 | ListView2->clear(); |
179 | ListView3->clear(); | 183 | ListView3->clear(); |
180 | ListView4->clear(); | 184 | ListView4->clear(); |
181 | ListView5->clear(); | 185 | ListView5->clear(); |
182 | 186 | ||
183 | qDebug("opening GUTINDEX.ALL file"); | 187 | odebug << "opening GUTINDEX.ALL file" << oendl; |
184 | IDontKnowWhy = ""; | 188 | IDontKnowWhy = ""; |
185 | if ( indexLib.open( IO_ReadOnly) ) { // file opened successfully | 189 | if ( indexLib.open( IO_ReadOnly) ) { // file opened successfully |
186 | QTextStream indexStream( &indexLib ); | 190 | QTextStream indexStream( &indexLib ); |
187 | QString indexLine; | 191 | QString indexLine; |
188 | qApp->processEvents(); | 192 | qApp->processEvents(); |
189 | // int jig; | 193 | // int jig; |
190 | while ( !indexStream.eof() ) { | 194 | while ( !indexStream.eof() ) { |
191 | 195 | ||
192 | indexLine = indexStream.readLine(); | 196 | indexLine = indexStream.readLine(); |
193 | if ( indexLine != "") { | 197 | if ( indexLine != "") { |
194 | if( (indexLine.mid(4,4)).toInt() /* && !( indexLine.left(3)).toInt()*/ ) { | 198 | if( (indexLine.mid(4,4)).toInt() /* && !( indexLine.left(3)).toInt()*/ ) { |
195 | // month = indexLine.left( 3); | 199 | // month = indexLine.left( 3); |
196 | year = indexLine.mid(4,4); | 200 | year = indexLine.mid(4,4); |
197 | // title = indexLine.mid( 9, 50); | 201 | // title = indexLine.mid( 9, 50); |
198 | file = indexLine.mid(60,12); | 202 | file = indexLine.mid(60,12); |
199 | if(file.left(1).find("[",0,TRUE) != -1) | 203 | if(file.left(1).find("[",0,TRUE) != -1) |
200 | file.remove(1,1); | 204 | file.remove(1,1); |
201 | if( file.find("]",0,TRUE) != -1) | 205 | if( file.find("]",0,TRUE) != -1) |
202 | file = file.left( file.find("]",0,TRUE)); | 206 | file = file.left( file.find("]",0,TRUE)); |
203 | //qDebug("file is "+file); | 207 | //odebug << "file is "+file << oendl; |
204 | /// number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); | 208 | /// number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); |
205 | number = indexLine.mid(55,5); | 209 | number = indexLine.mid(55,5); |
206 | number = number.stripWhiteSpace(); | 210 | number = number.stripWhiteSpace(); |
207 | // title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); | 211 | // title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); |
208 | title = indexLine.mid( 9, 50 ); | 212 | title = indexLine.mid( 9, 50 ); |
209 | title = title.stripWhiteSpace(); | 213 | title = title.stripWhiteSpace(); |
210 | //qDebug("title is "+title); | 214 | //odebug << "title is "+title << oendl; |
211 | getAuthor(); // grok author | 215 | getAuthor(); // grok author |
212 | author = author.stripWhiteSpace(); | 216 | author = author.stripWhiteSpace(); |
213 | //qDebug("author is "+author); | 217 | //odebug << "author is "+author << oendl; |
214 | if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author | 218 | if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author |
215 | QString lastName, firstName=""; | 219 | QString lastName, firstName=""; |
216 | int finder=author.findRev( ' ', -1, TRUE); | 220 | int finder=author.findRev( ' ', -1, TRUE); |
217 | lastName=author.right( author.length()-finder); | 221 | lastName=author.right( author.length()-finder); |
218 | firstName=author.left(finder); | 222 | firstName=author.left(finder); |
219 | lastName=lastName.stripWhiteSpace(); | 223 | lastName=lastName.stripWhiteSpace(); |
220 | firstName=firstName.stripWhiteSpace(); | 224 | firstName=firstName.stripWhiteSpace(); |
221 | 225 | ||
222 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names | 226 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names |
223 | author=lastName+", "+firstName; | 227 | author=lastName+", "+firstName; |
224 | } | 228 | } |
225 | 229 | ||
226 | if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) /*&& (file.find( "]",0, TRUE))*/ ) { | 230 | if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) /*&& (file.find( "]",0, TRUE))*/ ) { |
227 | // fill string list or something to be able to sort by Author | 231 | // fill string list or something to be able to sort by Author |
228 | if( author.isEmpty() ) | 232 | if( author.isEmpty() ) |
229 | QList_Item5 = new QListViewItem( ListView5, /*number, */title, author, year, file ); | 233 | QList_Item5 = new QListViewItem( ListView5, /*number, */title, author, year, file ); |
230 | else { | 234 | else { |
231 | if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || | 235 | if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || |
232 | (author.left(1) >= QString("a") && author.left(1) <= QString("f")) ) | 236 | (author.left(1) >= QString("a") && author.left(1) <= QString("f")) ) |
233 | QList_Item1 = new QListViewItem( ListView1, /* number,*/ title, author, year, file ); | 237 | QList_Item1 = new QListViewItem( ListView1, /* number,*/ title, author, year, file ); |
234 | 238 | ||
235 | else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) || | 239 | else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) || |
236 | (author.left(1) >= QString("g") && author.left(1) <= QString("m")) ) | 240 | (author.left(1) >= QString("g") && author.left(1) <= QString("m")) ) |
237 | QList_Item2 = new QListViewItem( ListView2, /* number,*/ title, author, year, file ); | 241 | QList_Item2 = new QListViewItem( ListView2, /* number,*/ title, author, year, file ); |
238 | 242 | ||
239 | else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) || | 243 | else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) || |
240 | (author.left(1) >= QString("n") && author.left(1) <= QString("r")) ) | 244 | (author.left(1) >= QString("n") && author.left(1) <= QString("r")) ) |
241 | QList_Item3 = new QListViewItem( ListView3, /* number,*/ title, author, year, file ); | 245 | QList_Item3 = new QListViewItem( ListView3, /* number,*/ title, author, year, file ); |
242 | 246 | ||
243 | else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) || | 247 | else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) || |
244 | (author.left(1) >= QString("s") && author.left(1) <= QString("z")) ) | 248 | (author.left(1) >= QString("s") && author.left(1) <= QString("z")) ) |
245 | QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file ); | 249 | QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file ); |
246 | } | 250 | } |
247 | } | 251 | } |
248 | } | 252 | } |
249 | } | 253 | } |
250 | } | 254 | } |
251 | indexLib.close(); | 255 | indexLib.close(); |
252 | } else { | 256 | } else { |
253 | QString sMsg; | 257 | QString sMsg; |
254 | sMsg = ( tr("Error opening local library index:\n "))+local_index; | 258 | sMsg = ( tr("Error opening local library index:\n "))+local_index; |
255 | QMessageBox::message( "Error",sMsg); | 259 | QMessageBox::message( "Error",sMsg); |
256 | } | 260 | } |
257 | 261 | ||
@@ -264,98 +268,98 @@ bool LibraryDialog::getAuthor() | |||
264 | { | 268 | { |
265 | if( title.contains( ", by", TRUE)) { | 269 | if( title.contains( ", by", TRUE)) { |
266 | int auth; | 270 | int auth; |
267 | auth = title.find(", by", 0, TRUE); | 271 | auth = title.find(", by", 0, TRUE); |
268 | author = title.right(title.length() - (auth + 4) ); | 272 | author = title.right(title.length() - (auth + 4) ); |
269 | if( int finder = author.find("[", 0, TRUE)) { | 273 | if( int finder = author.find("[", 0, TRUE)) { |
270 | author = author.left(finder); | 274 | author = author.left(finder); |
271 | } | 275 | } |
272 | } | 276 | } |
273 | else if ( title.contains( "by, ", TRUE) ) { | 277 | else if ( title.contains( "by, ", TRUE) ) { |
274 | int auth; | 278 | int auth; |
275 | auth = title.find("by, ", 0, TRUE); | 279 | auth = title.find("by, ", 0, TRUE); |
276 | author = title.right(title.length() - (auth + 4) ); | 280 | author = title.right(title.length() - (auth + 4) ); |
277 | if( int finder = author.find("[", 0, TRUE)) { | 281 | if( int finder = author.find("[", 0, TRUE)) { |
278 | author = author.left( finder); | 282 | author = author.left( finder); |
279 | } | 283 | } |
280 | } | 284 | } |
281 | else if ( title.contains( " by", TRUE) ) { | 285 | else if ( title.contains( " by", TRUE) ) { |
282 | int auth; | 286 | int auth; |
283 | auth = title.find(" by", 0, TRUE); | 287 | auth = title.find(" by", 0, TRUE); |
284 | author = title.right(title.length() - (auth + 3) ); | 288 | author = title.right(title.length() - (auth + 3) ); |
285 | if( int finder = author.find("[", 0, TRUE)) { | 289 | if( int finder = author.find("[", 0, TRUE)) { |
286 | author = author.left( finder); | 290 | author = author.left( finder); |
287 | } | 291 | } |
288 | } | 292 | } |
289 | else if ( title.contains( "by ", TRUE) ) { | 293 | else if ( title.contains( "by ", TRUE) ) { |
290 | int auth; | 294 | int auth; |
291 | auth = title.find("by ", 0, TRUE); | 295 | auth = title.find("by ", 0, TRUE); |
292 | author = title.right(title.length() - (auth + 3) ); | 296 | author = title.right(title.length() - (auth + 3) ); |
293 | if( int finder = author.find("[", 0, TRUE)) { | 297 | if( int finder = author.find("[", 0, TRUE)) { |
294 | author = author.left( finder); | 298 | author = author.left( finder); |
295 | } | 299 | } |
296 | } | 300 | } |
297 | else if ( title.contains( ",", TRUE) ) { | 301 | else if ( title.contains( ",", TRUE) ) { |
298 | int auth; | 302 | int auth; |
299 | auth = title.find(",", 0, TRUE); | 303 | auth = title.find(",", 0, TRUE); |
300 | author = title.right( title.length() - (auth + 1) ); | 304 | author = title.right( title.length() - (auth + 1) ); |
301 | if ( author.contains( ",", TRUE) ) { | 305 | if ( author.contains( ",", TRUE) ) { |
302 | int auth; | 306 | int auth; |
303 | auth = author.find(",", 0, TRUE); | 307 | auth = author.find(",", 0, TRUE); |
304 | author = author.right( author.length() - (auth + 1) ); | 308 | author = author.right( author.length() - (auth + 1) ); |
305 | } | 309 | } |
306 | if( int finder = author.find("[", 0, TRUE)) { | 310 | if( int finder = author.find("[", 0, TRUE)) { |
307 | author = author.left( finder); | 311 | author = author.left( finder); |
308 | } | 312 | } |
309 | } | 313 | } |
310 | else if ( title.contains( "/", TRUE) ) { | 314 | else if ( title.contains( "/", TRUE) ) { |
311 | int auth; | 315 | int auth; |
312 | auth = title.find("/", 0, TRUE); | 316 | auth = title.find("/", 0, TRUE); |
313 | author = title.right(title.length() - (auth + 1) ); | 317 | author = title.right(title.length() - (auth + 1) ); |
314 | if( int finder = author.find("[", 0, TRUE)) { | 318 | if( int finder = author.find("[", 0, TRUE)) { |
315 | author = author.left( finder); | 319 | author = author.left( finder); |
316 | } | 320 | } |
317 | } | 321 | } |
318 | else if ( title.contains( "of", TRUE) ) { | 322 | else if ( title.contains( "of", TRUE) ) { |
319 | int auth; | 323 | int auth; |
320 | auth = title.find("of", 0, TRUE); | 324 | auth = title.find("of", 0, TRUE); |
321 | author = title.right(title.length() - (auth + 2) ); | 325 | author = title.right(title.length() - (auth + 2) ); |
322 | if( int finder = author.find("[", 0, TRUE)) | 326 | if( int finder = author.find("[", 0, TRUE)) |
323 | { | 327 | { |
324 | author = author.left( finder); | 328 | author = author.left( finder); |
325 | } | 329 | } |
326 | } else { | 330 | } else { |
327 | author = ""; | 331 | author = ""; |
328 | } | 332 | } |
329 | if ( author.contains("et. al")) { | 333 | if ( author.contains("et. al")) { |
330 | int auth; | 334 | int auth; |
331 | auth = author.find("et. al", 0, TRUE); | 335 | auth = author.find("et. al", 0, TRUE); |
332 | author = author.left( auth ); | 336 | author = author.left( auth ); |
333 | } | 337 | } |
334 | if ( author.contains("#")) { | 338 | if ( author.contains("#")) { |
335 | int auth; | 339 | int auth; |
336 | auth = author.find("#", 0, TRUE); | 340 | auth = author.find("#", 0, TRUE); |
337 | author = author.left( auth); | 341 | author = author.left( auth); |
338 | } | 342 | } |
339 | if ( author.contains("(")) { | 343 | if ( author.contains("(")) { |
340 | int auth; | 344 | int auth; |
341 | auth = author.find("(", 0, TRUE); | 345 | auth = author.find("(", 0, TRUE); |
342 | author = author.left( auth); | 346 | author = author.left( auth); |
343 | } | 347 | } |
344 | if ( author.contains("et al")) { | 348 | if ( author.contains("et al")) { |
345 | int auth; | 349 | int auth; |
346 | auth = author.find("et al", 0, TRUE); | 350 | auth = author.find("et al", 0, TRUE); |
347 | author = author.left( auth ); | 351 | author = author.left( auth ); |
348 | } | 352 | } |
349 | QRegExp r = QRegExp("[0-9]", TRUE, FALSE); | 353 | QRegExp r = QRegExp("[0-9]", TRUE, FALSE); |
350 | if ( author.left(2).find( r) != -1 ) { | 354 | if ( author.left(2).find( r) != -1 ) { |
351 | author = ""; | 355 | author = ""; |
352 | } | 356 | } |
353 | // if( author.contains(" ", TRUE)) { | 357 | // if( author.contains(" ", TRUE)) { |
354 | // int suth = author.findRev(" ", -1, TRUE); | 358 | // int suth = author.findRev(" ", -1, TRUE); |
355 | // author = author.right( author.length() - suth); | 359 | // author = author.right( author.length() - suth); |
356 | // } | 360 | // } |
357 | 361 | ||
358 | // title | 362 | // title |
359 | // author | 363 | // author |
360 | return true; | 364 | return true; |
361 | }////// end getAuthor() | 365 | }////// end getAuthor() |
@@ -366,51 +370,51 @@ void LibraryDialog::select_title( QListViewItem * item) | |||
366 | { | 370 | { |
367 | if(item != NULL) { | 371 | if(item != NULL) { |
368 | i++; | 372 | i++; |
369 | int index = tabWidget->currentPageIndex(); | 373 | int index = tabWidget->currentPageIndex(); |
370 | DlglistItemTitle = item->text(0); | 374 | DlglistItemTitle = item->text(0); |
371 | DlglistItemYear = item->text(2); | 375 | DlglistItemYear = item->text(2); |
372 | DlglistItemFile = item->text(3); | 376 | DlglistItemFile = item->text(3); |
373 | switch (index) { | 377 | switch (index) { |
374 | case 0: { | 378 | case 0: { |
375 | ListView1->clearSelection(); | 379 | ListView1->clearSelection(); |
376 | } | 380 | } |
377 | break; | 381 | break; |
378 | case 1: { | 382 | case 1: { |
379 | ListView2->clearSelection(); | 383 | ListView2->clearSelection(); |
380 | } | 384 | } |
381 | break; | 385 | break; |
382 | case 2: { | 386 | case 2: { |
383 | ListView3->clearSelection(); | 387 | ListView3->clearSelection(); |
384 | } | 388 | } |
385 | break; | 389 | break; |
386 | case 3: { | 390 | case 3: { |
387 | ListView4->clearSelection(); | 391 | ListView4->clearSelection(); |
388 | } | 392 | } |
389 | break; | 393 | break; |
390 | case 4: { | 394 | case 4: { |
391 | ListView5->clearSelection(); | 395 | ListView5->clearSelection(); |
392 | } | 396 | } |
393 | break; | 397 | break; |
394 | }; | 398 | }; |
395 | } | 399 | } |
396 | 400 | ||
397 | if(DlglistItemTitle.length()>2) { | 401 | if(DlglistItemTitle.length()>2) { |
398 | // DlglistItemNumber = item->text(0); | 402 | // DlglistItemNumber = item->text(0); |
399 | item = 0; | 403 | item = 0; |
400 | qDebug( "string from librarydialog is:%s %s %s", DlglistItemYear.latin1(),DlglistItemFile.latin1(),DlglistItemNumber.latin1()); | 404 | odebug << "string from librarydialog is:" << DlglistItemYear << " " << DlglistItemFile << " " << DlglistItemNumber << "" << oendl; |
401 | qDebug("Title is "+DlglistItemTitle); | 405 | odebug << "Title is "+DlglistItemTitle << oendl; |
402 | 406 | ||
403 | // check for connection here | 407 | // check for connection here |
404 | // if( get_extext()) | 408 | // if( get_extext()) |
405 | 409 | ||
406 | if(download_Etext()) { | 410 | if(download_Etext()) { |
407 | // qDebug("get here 2"); | 411 | // odebug << "get here 2" << oendl; |
408 | if(i_binary == 1) { | 412 | if(i_binary == 1) { |
409 | 413 | ||
410 | } | 414 | } |
411 | if(checkBox->isChecked () ) { | 415 | if(checkBox->isChecked () ) { |
412 | accept(); | 416 | accept(); |
413 | } | 417 | } |
414 | } | 418 | } |
415 | } | 419 | } |
416 | } | 420 | } |
@@ -420,95 +424,95 @@ bool LibraryDialog::download_Etext() | |||
420 | // might have to use old gpl'd ftp for embedded!! | 424 | // might have to use old gpl'd ftp for embedded!! |
421 | Config cfg("Gutenbrowser"); | 425 | Config cfg("Gutenbrowser"); |
422 | cfg.setGroup("FTPsite"); | 426 | cfg.setGroup("FTPsite"); |
423 | ftp_host=cfg.readEntry("SiteName", "sailor.gutenberg.org"); | 427 | ftp_host=cfg.readEntry("SiteName", "sailor.gutenberg.org"); |
424 | ftp_base_dir= cfg.readEntry("base", "/pub/gutenberg"); | 428 | ftp_base_dir= cfg.readEntry("base", "/pub/gutenberg"); |
425 | 429 | ||
426 | qDebug("about to network dialog"); | 430 | odebug << "about to network dialog" << oendl; |
427 | QString NewlistItemNumber, NewlistItemYear, ls_result, result_line, s, dir, networkUrl, outputFile; | 431 | QString NewlistItemNumber, NewlistItemYear, ls_result, result_line, s, dir, networkUrl, outputFile; |
428 | 432 | ||
429 | //////////////////// FIXME- if 'x' is part of real name.... | 433 | //////////////////// FIXME- if 'x' is part of real name.... |
430 | NewlistItemFile = DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).left(DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).find("x", 1, FALSE)); | 434 | NewlistItemFile = DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).left(DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).find("x", 1, FALSE)); |
431 | 435 | ||
432 | if( NewlistItemFile.find( DlglistItemFile.left(4) ,0,TRUE) ==-1 ) { | 436 | if( NewlistItemFile.find( DlglistItemFile.left(4) ,0,TRUE) ==-1 ) { |
433 | NewlistItemFile.replace( 0,4, DlglistItemFile.left(4)); | 437 | NewlistItemFile.replace( 0,4, DlglistItemFile.left(4)); |
434 | qDebug("NewlistItemFile is now "+NewlistItemFile); | 438 | odebug << "NewlistItemFile is now "+NewlistItemFile << oendl; |
435 | } | 439 | } |
436 | NewlistItemYear = DlglistItemYear.right(2); | 440 | NewlistItemYear = DlglistItemYear.right(2); |
437 | int NewlistItemYear_Int = NewlistItemYear.toInt(0, 10); | 441 | int NewlistItemYear_Int = NewlistItemYear.toInt(0, 10); |
438 | qDebug(NewlistItemYear); | 442 | odebug << NewlistItemYear << oendl; |
439 | if (NewlistItemYear_Int < 91 && NewlistItemYear_Int > 70) { | 443 | if (NewlistItemYear_Int < 91 && NewlistItemYear_Int > 70) { |
440 | NewlistItemYear = "90"; | 444 | NewlistItemYear = "90"; |
441 | } | 445 | } |
442 | Edir ="etext" +NewlistItemYear; | 446 | Edir ="etext" +NewlistItemYear; |
443 | dir= ftp_base_dir + "/etext" +NewlistItemYear+"/"; | 447 | dir= ftp_base_dir + "/etext" +NewlistItemYear+"/"; |
444 | if( ftp_base_dir.find("=",0,true) ) | 448 | if( ftp_base_dir.find("=",0,true) ) |
445 | ftp_base_dir.remove( ftp_base_dir.find("=",0,true),1); | 449 | ftp_base_dir.remove( ftp_base_dir.find("=",0,true),1); |
446 | 450 | ||
447 | networkUrl= "ftp://"+ftp_host+dir; | 451 | networkUrl= "ftp://"+ftp_host+dir; |
448 | 452 | ||
449 | outputFile=local_library+".guten_temp"; | 453 | outputFile=local_library+".guten_temp"; |
450 | //qDebug("Download file:%s",NewlistItemFile.latin1() ); | 454 | //odebug << "Download file:" << NewlistItemFile << "" << oendl; |
451 | qDebug("Checking: "+ftp_host+" "+dir+" "+outputFile+" "+NewlistItemFile); | 455 | odebug << "Checking: "+ftp_host+" "+dir+" "+outputFile+" "+NewlistItemFile << oendl; |
452 | QStringList networkList; | 456 | QStringList networkList; |
453 | networkList.append((const char *)ftp_host); | 457 | networkList.append((const char *)ftp_host); |
454 | networkList.append((const char *)dir); | 458 | networkList.append((const char *)dir); |
455 | networkList.append((const char *)outputFile); | 459 | networkList.append((const char *)outputFile); |
456 | networkList.append((const char *)NewlistItemFile); | 460 | networkList.append((const char *)NewlistItemFile); |
457 | //<< (char *)ftp_host << (char *)dir << (char *)outputFile << (char *)NewlistItemFile; | 461 | //<< (char *)ftp_host << (char *)dir << (char *)outputFile << (char *)NewlistItemFile; |
458 | 462 | ||
459 | NetworkDialog *NetworkDlg; | 463 | NetworkDialog *NetworkDlg; |
460 | NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkList); | 464 | NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkList); |
461 | 465 | ||
462 | 466 | ||
463 | if( NetworkDlg->exec() != 0 ) { // use new, improved, *INSTANT* network-dialog-file-getterer | 467 | if( NetworkDlg->exec() != 0 ) { // use new, improved, *INSTANT* network-dialog-file-getterer |
464 | File_Name= NetworkDlg->localFileName; | 468 | File_Name= NetworkDlg->localFileName; |
465 | qDebug("back to Library from Network Dialog"); | 469 | odebug << "back to Library from Network Dialog" << oendl; |
466 | qDebug("Just downloaded "+NetworkDlg->localFileName); | 470 | odebug << "Just downloaded "+NetworkDlg->localFileName << oendl; |
467 | 471 | ||
468 | // if (File_Name.find( local_library, 0, TRUE) != -1 ) { //could not be found | 472 | // if (File_Name.find( local_library, 0, TRUE) != -1 ) { //could not be found |
469 | // QString oldName=File_Name; | 473 | // QString oldName=File_Name; |
470 | // File_Name.replace(0,local_library.length(),downDir); | 474 | // File_Name.replace(0,local_library.length(),downDir); |
471 | // qDebug("File_Name now is "+File_Name); | 475 | // odebug << "File_Name now is "+File_Name << oendl; |
472 | 476 | ||
473 | // } | 477 | // } |
474 | // rename .txt to .etx | 478 | // rename .txt to .etx |
475 | if(NetworkDlg->successDownload) { | 479 | if(NetworkDlg->successDownload) { |
476 | qDebug("Filename is "+File_Name); | 480 | odebug << "Filename is "+File_Name << oendl; |
477 | if(File_Name.right(4)==".txt") { | 481 | if(File_Name.right(4)==".txt") { |
478 | QString s_fileName=File_Name; | 482 | QString s_fileName=File_Name; |
479 | s_fileName.replace( s_fileName.length()-3,3,"gtn"); | 483 | s_fileName.replace( s_fileName.length()-3,3,"gtn"); |
480 | // s_fileName.replace( s_fileName.length()-3,3,"etx"); | 484 | // s_fileName.replace( s_fileName.length()-3,3,"etx"); |
481 | rename(File_Name.latin1(),s_fileName.latin1()); | 485 | rename(File_Name.latin1(),s_fileName.latin1()); |
482 | File_Name=s_fileName; | 486 | File_Name=s_fileName; |
483 | 487 | ||
484 | qDebug("Filename is now "+File_Name); | 488 | odebug << "Filename is now "+File_Name << oendl; |
485 | 489 | ||
486 | } | 490 | } |
487 | if(File_Name.length() > 5 ) { | 491 | if(File_Name.length() > 5 ) { |
488 | setTitle(); | 492 | setTitle(); |
489 | QFileInfo fi(File_Name); | 493 | QFileInfo fi(File_Name); |
490 | QString name_file=fi.fileName(); | 494 | QString name_file=fi.fileName(); |
491 | name_file=name_file.left(name_file.length()-4); | 495 | name_file=name_file.left(name_file.length()-4); |
492 | 496 | ||
493 | qDebug("Setting doclink"); | 497 | odebug << "Setting doclink" << oendl; |
494 | DocLnk lnk; | 498 | DocLnk lnk; |
495 | qDebug("name is "+name_file); | 499 | odebug << "name is "+name_file << oendl; |
496 | lnk.setName(name_file); //sets file name | 500 | lnk.setName(name_file); //sets file name |
497 | qDebug("Title is "+DlglistItemTitle); | 501 | odebug << "Title is "+DlglistItemTitle << oendl; |
498 | lnk.setComment(DlglistItemTitle); | 502 | lnk.setComment(DlglistItemTitle); |
499 | 503 | ||
500 | qDebug("Filename is "+File_Name); | 504 | odebug << "Filename is "+File_Name << oendl; |
501 | lnk.setFile(File_Name); //sets File property | 505 | lnk.setFile(File_Name); //sets File property |
502 | lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D | 506 | lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D |
503 | lnk.setExec(File_Name); | 507 | lnk.setExec(File_Name); |
504 | lnk.setIcon("gutenbrowser/Gutenbrowser"); | 508 | lnk.setIcon("gutenbrowser/Gutenbrowser"); |
505 | if(!lnk.writeLink()) { | 509 | if(!lnk.writeLink()) { |
506 | qDebug("Writing doclink did not work"); | 510 | odebug << "Writing doclink did not work" << oendl; |
507 | } else { | 511 | } else { |
508 | } | 512 | } |
509 | } else | 513 | } else |
510 | QMessageBox::message("Note","There was an error\nwith the file"); | 514 | QMessageBox::message("Note","There was an error\nwith the file"); |
511 | } | 515 | } |
512 | } | 516 | } |
513 | return true; | 517 | return true; |
514 | } | 518 | } |
@@ -518,43 +522,43 @@ bool LibraryDialog::httpDownload() | |||
518 | #ifndef Q_WS_QWS | 522 | #ifndef Q_WS_QWS |
519 | Config config("Gutenbrowser"); | 523 | Config config("Gutenbrowser"); |
520 | config.setGroup( "Browser" ); | 524 | config.setGroup( "Browser" ); |
521 | QString brow = config.readEntry("Preferred", ""); | 525 | QString brow = config.readEntry("Preferred", ""); |
522 | QString file_name = "./.guten_temp"; | 526 | QString file_name = "./.guten_temp"; |
523 | // config.setGroup( "HttpServer" ); | 527 | // config.setGroup( "HttpServer" ); |
524 | // QString s_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); | 528 | // QString s_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); |
525 | QString httpName = proxy_http + "/"+Edir; | 529 | QString httpName = proxy_http + "/"+Edir; |
526 | // progressBar->setProgress( i); | 530 | // progressBar->setProgress( i); |
527 | i++; | 531 | i++; |
528 | if ( brow != "Konq") { /////////// use lynx | 532 | if ( brow != "Konq") { /////////// use lynx |
529 | // QString cmd = "lynx -source " + httpName +" | cat >> " + file_name; | 533 | // QString cmd = "lynx -source " + httpName +" | cat >> " + file_name; |
530 | // system(cmd); | 534 | // system(cmd); |
531 | } else { //////////// use KFM | 535 | } else { //////////// use KFM |
532 | // KFM::download( httpName, file_name); | 536 | // KFM::download( httpName, file_name); |
533 | } | 537 | } |
534 | i++; | 538 | i++; |
535 | QFile tmp( file_name); | 539 | QFile tmp( file_name); |
536 | QString str; | 540 | QString str; |
537 | if (tmp.open(IO_ReadOnly)) { | 541 | if (tmp.open(IO_ReadOnly)) { |
538 | QTextStream t( &tmp ); // use a text stream | 542 | QTextStream t( &tmp ); // use a text stream |
539 | while ( !t.eof()) { | 543 | while ( !t.eof()) { |
540 | QString s = t.readLine(); | 544 | QString s = t.readLine(); |
541 | if (s.contains( NewlistItemFile, FALSE) && (s.contains(".txt")) ) { | 545 | if (s.contains( NewlistItemFile, FALSE) && (s.contains(".txt")) ) { |
542 | str = s.mid( s.find( ".txt\">"+NewlistItemFile, 0, TRUE)+6, (s.find( ".txt</A>", 0, TRUE) + 4) - ( s.find( ".txt\">"+NewlistItemFile, 0, TRUE)+6 ) ); | 546 | str = s.mid( s.find( ".txt\">"+NewlistItemFile, 0, TRUE)+6, (s.find( ".txt</A>", 0, TRUE) + 4) - ( s.find( ".txt\">"+NewlistItemFile, 0, TRUE)+6 ) ); |
543 | httpName += "/" + str; | 547 | httpName += "/" + str; |
544 | } | 548 | } |
545 | } //end of while loop | 549 | } //end of while loop |
546 | } | 550 | } |
547 | tmp.close(); | 551 | tmp.close(); |
548 | m_getFilePath = local_library + str; | 552 | m_getFilePath = local_library + str; |
549 | i++; | 553 | i++; |
550 | if ( brow != "KFM"){ ///////// use lynx | 554 | if ( brow != "KFM"){ ///////// use lynx |
551 | QString cmd = "lynx -source " + httpName +" | cat >> " + m_getFilePath; | 555 | QString cmd = "lynx -source " + httpName +" | cat >> " + m_getFilePath; |
552 | // QMessageBox::message("Error", cmd); | 556 | // QMessageBox::message("Error", cmd); |
553 | system(cmd); | 557 | system(cmd); |
554 | } else { ////////// use KFM | 558 | } else { ////////// use KFM |
555 | // KFM::download( httpName, m_getFilePath); | 559 | // KFM::download( httpName, m_getFilePath); |
556 | } | 560 | } |
557 | i++; | 561 | i++; |
558 | #endif | 562 | #endif |
559 | return false; | 563 | return false; |
560 | } | 564 | } |
@@ -563,6 +567,6 @@ void LibraryDialog::cancelIt() | |||
563 | { | 567 | { |
564 | saveConfig(); | 568 | saveConfig(); |
565 | 569 | ||
566 | DlglistItemNumber = ""; | 570 | DlglistItemNumber = ""; |
567 | this->reject(); | 571 | this->reject(); |
568 | } | 572 | } |
@@ -571,33 +575,33 @@ bool LibraryDialog::setTitle() | |||
571 | { | 575 | { |
572 | Config config("Gutenbrowser"); | 576 | Config config("Gutenbrowser"); |
573 | qDebug("setting title"); | 577 | odebug << "setting title" << oendl; |
574 | qDebug(DlglistItemTitle); | 578 | odebug << DlglistItemTitle << oendl; |
575 | 579 | ||
576 | if( DlglistItemTitle.find("[",0,TRUE) != -1) | 580 | if( DlglistItemTitle.find("[",0,TRUE) != -1) |
577 | DlglistItemTitle.replace(DlglistItemTitle.find("[",0,TRUE),1, "(" ); | 581 | DlglistItemTitle.replace(DlglistItemTitle.find("[",0,TRUE),1, "(" ); |
578 | if( DlglistItemTitle.find("]",0,TRUE) !=-1) | 582 | if( DlglistItemTitle.find("]",0,TRUE) !=-1) |
579 | DlglistItemTitle.replace(DlglistItemTitle.find("]",0,TRUE),1, ")" ); | 583 | DlglistItemTitle.replace(DlglistItemTitle.find("]",0,TRUE),1, ")" ); |
580 | qDebug("Title being set is "+DlglistItemTitle); | 584 | odebug << "Title being set is "+DlglistItemTitle << oendl; |
581 | int test = 0; | 585 | int test = 0; |
582 | QString ramble, temp; | 586 | QString ramble, temp; |
583 | config.setGroup("Files"); | 587 | config.setGroup("Files"); |
584 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); | 588 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); |
585 | int i_numofFiles = s_numofFiles.toInt(); | 589 | int i_numofFiles = s_numofFiles.toInt(); |
586 | for ( int i = 0; i <= i_numofFiles; i++){ | 590 | for ( int i = 0; i <= i_numofFiles; i++){ |
587 | temp.setNum( i); | 591 | temp.setNum( i); |
588 | ramble = config.readEntry( temp, "" ); | 592 | ramble = config.readEntry( temp, "" ); |
589 | if( strcmp( ramble, File_Name) == 0){ | 593 | if( strcmp( ramble, File_Name) == 0){ |
590 | test = 1; | 594 | test = 1; |
591 | } | 595 | } |
592 | } | 596 | } |
593 | config.setGroup("Files"); | 597 | config.setGroup("Files"); |
594 | config.writeEntry( "NumberOfFiles", i_numofFiles +1 ); | 598 | config.writeEntry( "NumberOfFiles", i_numofFiles +1 ); |
595 | QString interger; | 599 | QString interger; |
596 | interger.setNum( i_numofFiles +1); | 600 | interger.setNum( i_numofFiles +1); |
597 | config.writeEntry( interger, File_Name); | 601 | config.writeEntry( interger, File_Name); |
598 | config.setGroup( "Titles" ); | 602 | config.setGroup( "Titles" ); |
599 | config.writeEntry( File_Name, DlglistItemTitle); | 603 | config.writeEntry( File_Name, DlglistItemTitle); |
600 | 604 | ||
601 | test = 0; | 605 | test = 0; |
602 | return true; | 606 | return true; |
603 | } | 607 | } |
@@ -607,20 +611,20 @@ void LibraryDialog::saveConfig() | |||
607 | { | 611 | { |
608 | Config config("Gutenbrowser"); | 612 | Config config("Gutenbrowser"); |
609 | if( httpBox->isChecked() == TRUE) { | 613 | if( httpBox->isChecked() == TRUE) { |
610 | checked = 1; | 614 | checked = 1; |
611 | config.setGroup( "Proxy" ); | 615 | config.setGroup( "Proxy" ); |
612 | config.writeEntry("IsChecked", "TRUE"); | 616 | config.writeEntry("IsChecked", "TRUE"); |
613 | } else { | 617 | } else { |
614 | checked = 0; | 618 | checked = 0; |
615 | config.setGroup( "Proxy" ); | 619 | config.setGroup( "Proxy" ); |
616 | config.writeEntry("IsChecked", "FALSE"); | 620 | config.writeEntry("IsChecked", "FALSE"); |
617 | } | 621 | } |
618 | if (authBox->isChecked() == TRUE) { | 622 | if (authBox->isChecked() == TRUE) { |
619 | config.setGroup("SortAuth"); | 623 | config.setGroup("SortAuth"); |
620 | config.writeEntry("authSort", "TRUE"); | 624 | config.writeEntry("authSort", "TRUE"); |
621 | } else { | 625 | } else { |
622 | config.setGroup("SortAuth"); | 626 | config.setGroup("SortAuth"); |
623 | config.writeEntry("authSort", "FALSE"); | 627 | config.writeEntry("authSort", "FALSE"); |
624 | } | 628 | } |
625 | // config.write(); | 629 | // config.write(); |
626 | } | 630 | } |
@@ -631,135 +635,135 @@ void LibraryDialog::onButtonSearch() | |||
631 | { | 635 | { |
632 | ListView1->clearSelection(); | 636 | ListView1->clearSelection(); |
633 | ListView2->clearSelection(); | 637 | ListView2->clearSelection(); |
634 | ListView3->clearSelection(); | 638 | ListView3->clearSelection(); |
635 | ListView4->clearSelection(); | 639 | ListView4->clearSelection(); |
636 | ListView5->clearSelection(); | 640 | ListView5->clearSelection(); |
637 | 641 | ||
638 | int curTab=tabWidget->currentPageIndex(); | 642 | int curTab=tabWidget->currentPageIndex(); |
639 | SearchDialog* searchDlg; | 643 | SearchDialog* searchDlg; |
640 | 644 | ||
641 | // if( resultsList) | 645 | // if( resultsList) |
642 | searchDlg = new SearchDialog( this, "Library Search", TRUE); | 646 | searchDlg = new SearchDialog( this, "Library Search", TRUE); |
643 | searchDlg->setCaption( tr( "Library Search" ) ); | 647 | searchDlg->setCaption( tr( "Library Search" ) ); |
644 | searchDlg->setLabel( "- author or title"); | 648 | searchDlg->setLabel( "- author or title"); |
645 | QString resultString; | 649 | QString resultString; |
646 | int i_berger = 0; | 650 | int i_berger = 0; |
647 | if( searchDlg->exec() != 0 ) { | 651 | if( searchDlg->exec() != 0 ) { |
648 | QString searcherStr = searchDlg->get_text(); | 652 | QString searcherStr = searchDlg->get_text(); |
649 | int fluff=0; | 653 | int fluff=0; |
650 | 654 | ||
651 | // int tabPage = tabWidget->currentPageIndex(); | 655 | // int tabPage = tabWidget->currentPageIndex(); |
652 | // TODO ititerate here... struct<listViews>?? | 656 | // TODO ititerate here... struct<listViews>?? |
653 | 657 | ||
654 | QListViewItemIterator it1( ListView1 ); | 658 | QListViewItemIterator it1( ListView1 ); |
655 | QListViewItemIterator it2( ListView2 ); | 659 | QListViewItemIterator it2( ListView2 ); |
656 | QListViewItemIterator it3( ListView3 ); | 660 | QListViewItemIterator it3( ListView3 ); |
657 | QListViewItemIterator it4( ListView4 ); | 661 | QListViewItemIterator it4( ListView4 ); |
658 | QListViewItemIterator it5( ListView5 ); | 662 | QListViewItemIterator it5( ListView5 ); |
659 | 663 | ||
660 | //// this is really pitiful work, | 664 | //// this is really pitiful work, |
661 | /////// | 665 | /////// |
662 | bool cS; | 666 | bool cS; |
663 | if( searchDlg->caseSensitiveCheckBox->isChecked()) | 667 | if( searchDlg->caseSensitiveCheckBox->isChecked()) |
664 | cS=true; //case sensitive | 668 | cS=true; //case sensitive |
665 | else | 669 | else |
666 | cS=false; | 670 | cS=false; |
667 | 671 | ||
668 | if(fluff==0) { | 672 | if(fluff==0) { |
669 | for ( ; it1.current(); ++it1 ) { | 673 | for ( ; it1.current(); ++it1 ) { |
670 | resultString = ( it1.current() )->text(0); | 674 | resultString = ( it1.current() )->text(0); |
671 | resultString += (" : "); | 675 | resultString += (" : "); |
672 | resultString += ( it1.current() )->text(2); | 676 | resultString += ( it1.current() )->text(2); |
673 | resultString += (" : "); | 677 | resultString += (" : "); |
674 | resultString += ( it1.current() )->text(3); | 678 | resultString += ( it1.current() )->text(3); |
675 | if( resultString.find( searcherStr, 0, cS) != -1) | 679 | if( resultString.find( searcherStr, 0, cS) != -1) |
676 | { | 680 | { |
677 | Searchlist.append( resultString); | 681 | Searchlist.append( resultString); |
678 | } | 682 | } |
679 | } | 683 | } |
680 | } | 684 | } |
681 | if(fluff==0) {// search routine here | 685 | if(fluff==0) {// search routine here |
682 | for ( ; it2.current(); ++it2 ) { | 686 | for ( ; it2.current(); ++it2 ) { |
683 | resultString = ( it2.current() )->text(0); | 687 | resultString = ( it2.current() )->text(0); |
684 | resultString += (" : "); | 688 | resultString += (" : "); |
685 | resultString += ( it2.current() )->text(2); | 689 | resultString += ( it2.current() )->text(2); |
686 | resultString += (" : "); | 690 | resultString += (" : "); |
687 | resultString += ( it2.current() )->text(3); | 691 | resultString += ( it2.current() )->text(3); |
688 | if( resultString.find( searcherStr, 0, cS) != -1) { | 692 | if( resultString.find( searcherStr, 0, cS) != -1) { |
689 | Searchlist.append( resultString); | 693 | Searchlist.append( resultString); |
690 | } | 694 | } |
691 | } | 695 | } |
692 | } | 696 | } |
693 | if(fluff==0) {// search routine here | 697 | if(fluff==0) {// search routine here |
694 | for ( ; it3.current(); ++it3 ) { | 698 | for ( ; it3.current(); ++it3 ) { |
695 | resultString = ( it3.current() )->text(0); | 699 | resultString = ( it3.current() )->text(0); |
696 | resultString += (" : "); | 700 | resultString += (" : "); |
697 | resultString += ( it3.current() )->text(2); | 701 | resultString += ( it3.current() )->text(2); |
698 | resultString += (" : "); | 702 | resultString += (" : "); |
699 | resultString += ( it3.current() )->text(3); | 703 | resultString += ( it3.current() )->text(3); |
700 | 704 | ||
701 | if( resultString.find( searcherStr, 0, cS) != -1) { | 705 | if( resultString.find( searcherStr, 0, cS) != -1) { |
702 | Searchlist.append( resultString); | 706 | Searchlist.append( resultString); |
703 | } | 707 | } |
704 | } | 708 | } |
705 | } | 709 | } |
706 | if(fluff==0) { | 710 | if(fluff==0) { |
707 | // search routine here | 711 | // search routine here |
708 | for ( ; it4.current(); ++it4 ) { | 712 | for ( ; it4.current(); ++it4 ) { |
709 | resultString = ( it4.current() )->text(0); | 713 | resultString = ( it4.current() )->text(0); |
710 | resultString += (" : "); | 714 | resultString += (" : "); |
711 | resultString += ( it4.current() )->text(2); | 715 | resultString += ( it4.current() )->text(2); |
712 | resultString += (" : "); | 716 | resultString += (" : "); |
713 | resultString += ( it4.current() )->text(3); | 717 | resultString += ( it4.current() )->text(3); |
714 | if( resultString.find( searcherStr, 0, cS) != -1) { | 718 | if( resultString.find( searcherStr, 0, cS) != -1) { |
715 | Searchlist.append( resultString); | 719 | Searchlist.append( resultString); |
716 | } | 720 | } |
717 | } | 721 | } |
718 | } | 722 | } |
719 | if(fluff==0) { // search routine here | 723 | if(fluff==0) { // search routine here |
720 | for ( ; it5.current(); ++it5 ) { | 724 | for ( ; it5.current(); ++it5 ) { |
721 | resultString = ( it5.current() )->text(0); | 725 | resultString = ( it5.current() )->text(0); |
722 | resultString += (" : "); | 726 | resultString += (" : "); |
723 | resultString += ( it5.current() )->text(2); | 727 | resultString += ( it5.current() )->text(2); |
724 | resultString += (" : "); | 728 | resultString += (" : "); |
725 | resultString += ( it5.current() )->text(3); | 729 | resultString += ( it5.current() )->text(3); |
726 | if( resultString.find( searcherStr, 0, cS) != -1) { | 730 | if( resultString.find( searcherStr, 0, cS) != -1) { |
727 | Searchlist.append( resultString); | 731 | Searchlist.append( resultString); |
728 | } | 732 | } |
729 | } | 733 | } |
730 | } | 734 | } |
731 | 735 | ||
732 | tabWidget->setCurrentPage( curTab); | 736 | tabWidget->setCurrentPage( curTab); |
733 | 737 | ||
734 | Searchlist.sort(); | 738 | Searchlist.sort(); |
735 | SearchResultsDlg* SearchResultsDialog; | 739 | SearchResultsDlg* SearchResultsDialog; |
736 | SearchResultsDialog = new SearchResultsDlg( searchDlg, "Results Dialog", true, 0 , Searchlist); | 740 | SearchResultsDialog = new SearchResultsDlg( searchDlg, "Results Dialog", true, 0 , Searchlist); |
737 | 741 | ||
738 | SearchResultsDialog->showMaximized(); | 742 | SearchResultsDialog->showMaximized(); |
739 | if( SearchResultsDialog->exec() != 0) { | 743 | if( SearchResultsDialog->exec() != 0) { |
740 | texter = SearchResultsDialog->selText; | 744 | texter = SearchResultsDialog->selText; |
741 | // qDebug(texter); | 745 | // odebug << texter << oendl; |
742 | resultLs= SearchResultsDialog->resultsList; | 746 | resultLs= SearchResultsDialog->resultsList; |
743 | i_berger = 1; | 747 | i_berger = 1; |
744 | } | 748 | } |
745 | Searchlist.clear(); | 749 | Searchlist.clear(); |
746 | 750 | ||
747 | // if(SearchResultsDialog) | 751 | // if(SearchResultsDialog) |
748 | // delete SearchResultsDialog; | 752 | // delete SearchResultsDialog; |
749 | QString tester; | 753 | QString tester; |
750 | for ( QStringList::Iterator it = resultLs.begin(); it != resultLs.end(); ++it ) { | 754 | for ( QStringList::Iterator it = resultLs.begin(); it != resultLs.end(); ++it ) { |
751 | texter.sprintf("%s \n",(*it).latin1()); | 755 | texter.sprintf("%s \n",(*it).latin1()); |
752 | // qDebug(texter); | 756 | // odebug << texter << oendl; |
753 | if( tester!=texter) | 757 | if( tester!=texter) |
754 | parseSearchResults( texter); | 758 | parseSearchResults( texter); |
755 | tester = texter; | 759 | tester = texter; |
756 | } | 760 | } |
757 | if(searchDlg) | 761 | if(searchDlg) |
758 | delete searchDlg; | 762 | delete searchDlg; |
759 | } | 763 | } |
760 | if(checkBox->isChecked() ) { | 764 | if(checkBox->isChecked() ) { |
761 | accept(); | 765 | accept(); |
762 | } else { | 766 | } else { |
763 | setActiveWindow(); | 767 | setActiveWindow(); |
764 | } | 768 | } |
765 | } | 769 | } |
@@ -771,16 +775,16 @@ void LibraryDialog::parseSearchResults( QString resultStr) | |||
771 | 775 | ||
772 | int stringLeng=resultStr.length(); | 776 | int stringLeng=resultStr.length(); |
773 | QString my; | 777 | QString my; |
774 | my.setNum( stringLeng, 10); | 778 | my.setNum( stringLeng, 10); |
775 | 779 | ||
776 | if( resultStr.length() > 2 && resultStr.length() < 130) { | 780 | if( resultStr.length() > 2 && resultStr.length() < 130) { |
777 | int titleInt = resultStr.find( " : ", 0, TRUE); | 781 | int titleInt = resultStr.find( " : ", 0, TRUE); |
778 | DlglistItemTitle = resultStr.left( titleInt); | 782 | DlglistItemTitle = resultStr.left( titleInt); |
779 | int yearInt = resultStr.find( " : ", titleInt+3, TRUE); | 783 | int yearInt = resultStr.find( " : ", titleInt+3, TRUE); |
780 | DlglistItemYear = resultStr.mid( titleInt+3, (yearInt - titleInt)-3); | 784 | DlglistItemYear = resultStr.mid( titleInt+3, (yearInt - titleInt)-3); |
781 | DlglistItemFile = resultStr.right( resultStr.length() - (yearInt + 3)); | 785 | DlglistItemFile = resultStr.right( resultStr.length() - (yearInt + 3)); |
782 | download_Etext(); | 786 | download_Etext(); |
783 | } | 787 | } |
784 | /* | 788 | /* |
785 | printf( DlglistItemTitle+"\n"); printf( DlglistItemYear+"\n"); printf( DlglistItemFile+"\n");*/ | 789 | printf( DlglistItemTitle+"\n"); printf( DlglistItemYear+"\n"); printf( DlglistItemFile+"\n");*/ |
786 | } | 790 | } |
@@ -808,3 +812,3 @@ void LibraryDialog::parseSearchResults( QString resultStr) | |||
808 | // if (exit==QMessageBox::Yes) { | 812 | // if (exit==QMessageBox::Yes) { |
809 | // qDebug("Issuing the command "+cmd); | 813 | // odebug << "Issuing the command "+cmd << oendl; |
810 | // #if defined(_WS_WIN_) | 814 | // #if defined(_WS_WIN_) |
@@ -842,14 +846,14 @@ bool LibraryDialog::getItem(QListViewItem *it) | |||
842 | { | 846 | { |
843 | // qDebug("selected getItem"); | 847 | // odebug << "selected getItem" << oendl; |
844 | 848 | ||
845 | // DlglistItemNumber = it->text(0); | 849 | // DlglistItemNumber = it->text(0); |
846 | DlglistItemTitle = it->text(0); | 850 | DlglistItemTitle = it->text(0); |
847 | DlglistItemYear = it->text(2); | 851 | DlglistItemYear = it->text(2); |
848 | DlglistItemFile = it->text(3); | 852 | DlglistItemFile = it->text(3); |
849 | 853 | ||
850 | if(download_Etext()) { | 854 | if(download_Etext()) { |
851 | if(i_binary == 1) { | 855 | if(i_binary == 1) { |
852 | } | 856 | } |
853 | } | 857 | } |
854 | return true; | 858 | return true; |
855 | } | 859 | } |
@@ -860,37 +864,37 @@ bool LibraryDialog::onButtonDownload() | |||
860 | { | 864 | { |
861 | // qDebug("selected onButtonDownloadz"); | 865 | // odebug << "selected onButtonDownloadz" << oendl; |
862 | 866 | ||
863 | QListViewItemIterator it1( ListView1 ); | 867 | QListViewItemIterator it1( ListView1 ); |
864 | QListViewItemIterator it2( ListView2 ); | 868 | QListViewItemIterator it2( ListView2 ); |
865 | QListViewItemIterator it3( ListView3 ); | 869 | QListViewItemIterator it3( ListView3 ); |
866 | QListViewItemIterator it4( ListView4 ); | 870 | QListViewItemIterator it4( ListView4 ); |
867 | QListViewItemIterator it5( ListView5 ); | 871 | QListViewItemIterator it5( ListView5 ); |
868 | 872 | ||
869 | // iterate through all items of the listview | 873 | // iterate through all items of the listview |
870 | for ( ; it1.current(); ++it1 ) { | 874 | for ( ; it1.current(); ++it1 ) { |
871 | if ( it1.current()->isSelected() ) | 875 | if ( it1.current()->isSelected() ) |
872 | getItem(it1.current()); | 876 | getItem(it1.current()); |
873 | it1.current()->setSelected(FALSE); | 877 | it1.current()->setSelected(FALSE); |
874 | } | 878 | } |
875 | for ( ; it2.current(); ++it2 ) { | 879 | for ( ; it2.current(); ++it2 ) { |
876 | if ( it2.current()->isSelected() ) | 880 | if ( it2.current()->isSelected() ) |
877 | getItem(it2.current()); | 881 | getItem(it2.current()); |
878 | it2.current()->setSelected(FALSE); | 882 | it2.current()->setSelected(FALSE); |
879 | } | 883 | } |
880 | for ( ; it3.current(); ++it3 ) { | 884 | for ( ; it3.current(); ++it3 ) { |
881 | if ( it3.current()->isSelected() ) | 885 | if ( it3.current()->isSelected() ) |
882 | getItem(it3.current()); | 886 | getItem(it3.current()); |
883 | it3.current()->setSelected(FALSE); | 887 | it3.current()->setSelected(FALSE); |
884 | } | 888 | } |
885 | for ( ; it4.current(); ++it4 ) { | 889 | for ( ; it4.current(); ++it4 ) { |
886 | if ( it4.current()->isSelected() ) | 890 | if ( it4.current()->isSelected() ) |
887 | getItem(it4.current()); | 891 | getItem(it4.current()); |
888 | it4.current()->setSelected(FALSE); | 892 | it4.current()->setSelected(FALSE); |
889 | } | 893 | } |
890 | for ( ; it5.current(); ++it5 ) { | 894 | for ( ; it5.current(); ++it5 ) { |
891 | if ( it5.current()->isSelected() ) | 895 | if ( it5.current()->isSelected() ) |
892 | getItem(it5.current()); | 896 | getItem(it5.current()); |
893 | it5.current()->setSelected(FALSE); | 897 | it5.current()->setSelected(FALSE); |
894 | } | 898 | } |
895 | return true; | 899 | return true; |
896 | } | 900 | } |
@@ -902,20 +906,20 @@ void LibraryDialog::comboSelect(int index) | |||
902 | { | 906 | { |
903 | // qDebug("we are sorting"); | 907 | // odebug << "we are sorting" << oendl; |
904 | ListView1->setSorting( index, TRUE); | 908 | ListView1->setSorting( index, TRUE); |
905 | ListView2->setSorting( index, TRUE); | 909 | ListView2->setSorting( index, TRUE); |
906 | ListView3->setSorting( index, TRUE); | 910 | ListView3->setSorting( index, TRUE); |
907 | ListView4->setSorting( index, TRUE); | 911 | ListView4->setSorting( index, TRUE); |
908 | ListView5->setSorting( index, TRUE); | 912 | ListView5->setSorting( index, TRUE); |
909 | 913 | ||
910 | ListView1->sort(); | 914 | ListView1->sort(); |
911 | ListView2->sort(); | 915 | ListView2->sort(); |
912 | ListView3->sort(); | 916 | ListView3->sort(); |
913 | ListView4->sort(); | 917 | ListView4->sort(); |
914 | ListView5->sort(); | 918 | ListView5->sort(); |
915 | 919 | ||
916 | // ListView1->triggerUpdate(); | 920 | // ListView1->triggerUpdate(); |
917 | // ListView2->triggerUpdate(); | 921 | // ListView2->triggerUpdate(); |
918 | // ListView3->triggerUpdate(); | 922 | // ListView3->triggerUpdate(); |
919 | // ListView4->triggerUpdate(); | 923 | // ListView4->triggerUpdate(); |
920 | // ListView5->triggerUpdate(); | 924 | // ListView5->triggerUpdate(); |
921 | } | 925 | } |
@@ -924,60 +928,60 @@ void LibraryDialog::newList() | |||
924 | { | 928 | { |
925 | if(indexLoaded) { | 929 | if(indexLoaded) { |
926 | onButtonDownload(); | 930 | onButtonDownload(); |
927 | } else { | 931 | } else { |
928 | Output *outDlg; | 932 | Output *outDlg; |
929 | buttonNewList->setDown(TRUE); | 933 | buttonNewList->setDown(TRUE); |
930 | QDir gutDir(QPEApplication::qpeDir()+"etc/gutenbrowser"); | 934 | QDir gutDir(QPEApplication::qpeDir()+"etc/gutenbrowser"); |
931 | if(!gutDir.exists()) gutDir.mkdir(QPEApplication::qpeDir()+"etc/gutenbrowser",true); | 935 | if(!gutDir.exists()) gutDir.mkdir(QPEApplication::qpeDir()+"etc/gutenbrowser",true); |
932 | if( chdir(QPEApplication::qpeDir()+"etc/gutenbrowser") == 0) { | 936 | if( chdir(QPEApplication::qpeDir()+"etc/gutenbrowser") == 0) { |
933 | qDebug("changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser"); | 937 | odebug << "changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser" << oendl; |
934 | QString gutenindex1 = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; | 938 | QString gutenindex1 = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; |
935 | QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1"; | 939 | QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1"; |
936 | 940 | ||
937 | int result = QMessageBox::warning( this,"Download" | 941 | int result = QMessageBox::warning( this,"Download" |
938 | ,"Ok to use /'wget/' to download\na new library list?\n" | 942 | ,"Ok to use /'wget/' to download\na new library list?\n" |
939 | ,"Yes","No",0,0,1); | 943 | ,"Yes","No",0,0,1); |
940 | qApp->processEvents(); | 944 | qApp->processEvents(); |
941 | if(result == 0) { | 945 | if(result == 0) { |
942 | outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),TRUE); | 946 | outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),TRUE); |
943 | outDlg->showMaximized(); | 947 | outDlg->showMaximized(); |
944 | outDlg->show(); | 948 | outDlg->show(); |
945 | qApp->processEvents(); | 949 | qApp->processEvents(); |
946 | FILE *fp; | 950 | FILE *fp; |
947 | char line[130]; | 951 | char line[130]; |
948 | outDlg->OutputEdit->append( tr("Running wget") ); | 952 | outDlg->OutputEdit->append( tr("Running wget") ); |
949 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 953 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
950 | sleep(1); | 954 | sleep(1); |
951 | fp = popen( (const char *) cmd, "r"); | 955 | fp = popen( (const char *) cmd, "r"); |
952 | if ( !fp ) { | 956 | if ( !fp ) { |
953 | } else { | 957 | } else { |
954 | qDebug("Issuing the command\n"+cmd); | 958 | odebug << "Issuing the command\n"+cmd << oendl; |
955 | // system(cmd); | 959 | // system(cmd); |
956 | while ( fgets( line, sizeof line, fp)) { | 960 | while ( fgets( line, sizeof line, fp)) { |
957 | outDlg->OutputEdit->append(line); | 961 | outDlg->OutputEdit->append(line); |
958 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 962 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
959 | } | 963 | } |
960 | pclose(fp); | 964 | pclose(fp); |
961 | outDlg->OutputEdit->append("Finished downloading\n"); | 965 | outDlg->OutputEdit->append("Finished downloading\n"); |
962 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 966 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
963 | qApp->processEvents(); | 967 | qApp->processEvents(); |
964 | 968 | ||
965 | // if( QFile(gutenindex1).exists() ) { | 969 | // if( QFile(gutenindex1).exists() ) { |
966 | // QString gutenindex=QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; | 970 | // QString gutenindex=QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; |
967 | // if( rename(gutenindex1.latin1(),gutenindex.latin1()) !=0) | 971 | // if( rename(gutenindex1.latin1(),gutenindex.latin1()) !=0) |
968 | // qDebug("renaming error"); | 972 | // odebug << "renaming error" << oendl; |
969 | // } | 973 | // } |
970 | 974 | ||
971 | } | 975 | } |
972 | // outDlg->close(); | 976 | // outDlg->close(); |
973 | FindLibrary(); | 977 | FindLibrary(); |
974 | if(outDlg) delete outDlg; | 978 | if(outDlg) delete outDlg; |
975 | } | 979 | } |
976 | buttonNewList->setDown(FALSE); | 980 | buttonNewList->setDown(FALSE); |
977 | } else { | 981 | } else { |
978 | QMessageBox::message("Note","Could not change directories"); | 982 | QMessageBox::message("Note","Could not change directories"); |
979 | } | 983 | } |
980 | // if(outDlg) | 984 | // if(outDlg) |
981 | // delete outDlg; | 985 | // delete outDlg; |
982 | } | 986 | } |
983 | } | 987 | } |
@@ -987,52 +991,52 @@ bool LibraryDialog::moreInfo() | |||
987 | 991 | ||
988 | QListViewItem * item; | 992 | QListViewItem * item; |
989 | item = 0; | 993 | item = 0; |
990 | QString titleString; | 994 | QString titleString; |
991 | item = ListView1->currentItem(); | 995 | item = ListView1->currentItem(); |
992 | if( item != 0) { | 996 | if( item != 0) { |
993 | titleString = item->text(0); | 997 | titleString = item->text(0); |
994 | ListView1->clearSelection(); | 998 | ListView1->clearSelection(); |
995 | item = 0; | 999 | item = 0; |
996 | } | 1000 | } |
997 | if( item == 0) | 1001 | if( item == 0) |
998 | item = ListView2->currentItem(); | 1002 | item = ListView2->currentItem(); |
999 | if( item != 0) { | 1003 | if( item != 0) { |
1000 | titleString = item->text(0); | 1004 | titleString = item->text(0); |
1001 | ListView2->clearSelection(); | 1005 | ListView2->clearSelection(); |
1002 | item = 0; | 1006 | item = 0; |
1003 | } | 1007 | } |
1004 | if( item == 0) | 1008 | if( item == 0) |
1005 | item = ListView3->currentItem(); | 1009 | item = ListView3->currentItem(); |
1006 | if( item != 0) { | 1010 | if( item != 0) { |
1007 | titleString = item->text(0); | 1011 | titleString = item->text(0); |
1008 | ListView3->clearSelection(); | 1012 | ListView3->clearSelection(); |
1009 | item = 0; | 1013 | item = 0; |
1010 | } | 1014 | } |
1011 | if( item == 0) | 1015 | if( item == 0) |
1012 | item = ListView4->currentItem(); | 1016 | item = ListView4->currentItem(); |
1013 | if( item != 0) { | 1017 | if( item != 0) { |
1014 | titleString = item->text(0); | 1018 | titleString = item->text(0); |
1015 | ListView4->clearSelection(); | 1019 | ListView4->clearSelection(); |
1016 | item = 0; | 1020 | item = 0; |
1017 | } | 1021 | } |
1018 | if( item == 0) | 1022 | if( item == 0) |
1019 | item = ListView5->currentItem(); | 1023 | item = ListView5->currentItem(); |
1020 | if( item != 0) { | 1024 | if( item != 0) { |
1021 | titleString = item->text(0); | 1025 | titleString = item->text(0); |
1022 | ListView5->clearSelection(); | 1026 | ListView5->clearSelection(); |
1023 | item = 0; | 1027 | item = 0; |
1024 | } | 1028 | } |
1025 | item=0; | 1029 | item=0; |
1026 | if(titleString.length()>2) { | 1030 | if(titleString.length()>2) { |
1027 | qDebug( "Title is "+titleString ); | 1031 | odebug << "Title is "+titleString << oendl; |
1028 | titleString.replace( QRegExp("\\s"), "%20"); | 1032 | titleString.replace( QRegExp("\\s"), "%20"); |
1029 | titleString.replace( QRegExp("'"), "%20"); | 1033 | titleString.replace( QRegExp("'"), "%20"); |
1030 | titleString.replace( QRegExp("\""), "%20"); | 1034 | titleString.replace( QRegExp("\""), "%20"); |
1031 | titleString.replace( QRegExp("&"), "%20"); | 1035 | titleString.replace( QRegExp("&"), "%20"); |
1032 | QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search"; | 1036 | QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search"; |
1033 | cmd="opera "+cmd; | 1037 | cmd="opera "+cmd; |
1034 | system(cmd); | 1038 | system(cmd); |
1035 | } else | 1039 | } else |
1036 | QMessageBox::message( "Note","If you select a title, this will\nsearch google.com for that title."); | 1040 | QMessageBox::message( "Note","If you select a title, this will\nsearch google.com for that title."); |
1037 | return true; | 1041 | return true; |
1038 | 1042 | ||
@@ -1044,23 +1048,23 @@ void LibraryDialog::FindLibrary() | |||
1044 | { | 1048 | { |
1045 | buttonLibrary->setDown(TRUE); | 1049 | buttonLibrary->setDown(TRUE); |
1046 | 1050 | ||
1047 | qApp->processEvents(); | 1051 | qApp->processEvents(); |
1048 | if( QFile( new_index).exists() /* && this->isHidden() */) { | 1052 | if( QFile( new_index).exists() /* && this->isHidden() */) { |
1049 | newindexLib.setName( new_index); | 1053 | newindexLib.setName( new_index); |
1050 | indexLib.setName( new_index); | 1054 | indexLib.setName( new_index); |
1051 | qDebug("index file is "+ new_index); | 1055 | odebug << "index file is "+ new_index << oendl; |
1052 | Newlibrary(); | 1056 | Newlibrary(); |
1053 | } else { | 1057 | } else { |
1054 | newindexLib.setName( old_index); | 1058 | newindexLib.setName( old_index); |
1055 | indexLib.setName( old_index); | 1059 | indexLib.setName( old_index); |
1056 | qDebug("new index nameis "+ old_index); | 1060 | odebug << "new index nameis "+ old_index << oendl; |
1057 | Library(); | 1061 | Library(); |
1058 | } | 1062 | } |
1059 | indexLoaded=true; | 1063 | indexLoaded=true; |
1060 | buttonSearch->setEnabled(TRUE); | 1064 | buttonSearch->setEnabled(TRUE); |
1061 | moreInfoButton->setEnabled(TRUE); | 1065 | moreInfoButton->setEnabled(TRUE); |
1062 | 1066 | ||
1063 | buttonLibrary->setDown(FALSE); | 1067 | buttonLibrary->setDown(FALSE); |
1064 | buttonNewList->setText("Download"); | 1068 | buttonNewList->setText("Download"); |
1065 | qApp->processEvents(); | 1069 | qApp->processEvents(); |
1066 | 1070 | ||
diff --git a/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp b/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp index aed53c6..6e6b707 100644 --- a/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp | |||
@@ -12,7 +12,3 @@ | |||
12 | // /* Created: Sun Aug 27 15:24:52 2000*/ | 12 | // /* Created: Sun Aug 27 15:24:52 2000*/ |
13 | #include <unistd.h> | ||
14 | 13 | ||
15 | extern "C" { | ||
16 | #include <ftplib.h> | ||
17 | } | ||
18 | 14 | ||
@@ -21,2 +17,6 @@ extern "C" { | |||
21 | 17 | ||
18 | /* OPIE */ | ||
19 | #include <opie2/odebug.h> | ||
20 | |||
21 | /* QT */ | ||
22 | #include <qprogressbar.h> | 22 | #include <qprogressbar.h> |
@@ -32,2 +32,8 @@ extern "C" { | |||
32 | 32 | ||
33 | /* STD */ | ||
34 | #include <unistd.h> | ||
35 | extern "C" { | ||
36 | #include <ftplib.h> | ||
37 | } | ||
38 | |||
33 | QProgressBar* ProgressBar1; | 39 | QProgressBar* ProgressBar1; |
@@ -48,3 +54,3 @@ static int log_progress(netbuf *ctl, int xfered, void *arg) { | |||
48 | NetworkDialog::NetworkDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QStringList netL) | 54 | NetworkDialog::NetworkDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QStringList netL) |
49 | : QDialog( parent, name, modal, fl ) | 55 | : QDialog( parent, name, modal, fl ) |
50 | { | 56 | { |
@@ -55,9 +61,9 @@ NetworkDialog::NetworkDialog( QWidget* parent, const char* name, bool modal, WF | |||
55 | dir = ftp_base_dir = netL[1]; | 61 | dir = ftp_base_dir = netL[1]; |
56 | localFileName = netL[2]; | 62 | localFileName = netL[2]; |
57 | s_partialFileName = netL[3]; | 63 | s_partialFileName = netL[3]; |
58 | 64 | ||
59 | resize(240,110); | 65 | resize(240,110); |
60 | 66 | ||
61 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; | 67 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; |
62 | // autoOk = autoDownload; | 68 | // autoOk = autoDownload; |
63 | // if( networkUrl.find("ftp",0,false)== -1 ) { | 69 | // if( networkUrl.find("ftp",0,false)== -1 ) { |
@@ -120,7 +126,7 @@ void NetworkDialog::initDialog() { | |||
120 | // connect( connectionTimer,SIGNAL( timeout()),this,SLOT( connectionTimeSlot())); | 126 | // connect( connectionTimer,SIGNAL( timeout()),this,SLOT( connectionTimeSlot())); |
121 | if(autoOk) { | 127 | if(autoOk) { |
122 | qWarning("XXXXXXXXXXXXXXXXXXXXXXXX"); | 128 | owarn << "XXXXXXXXXXXXXXXXXXXXXXXX" << oendl; |
123 | buttonOk->setDown(true); | 129 | buttonOk->setDown(true); |
124 | doOk(); | 130 | doOk(); |
125 | } | 131 | } |
126 | } | 132 | } |
@@ -145,3 +151,3 @@ void NetworkDialog::timeSlot() { | |||
145 | // } | 151 | // } |
146 | // // qDebug("timer event"); | 152 | // // odebug << "timer event" << oendl; |
147 | // qApp->processEvents(); | 153 | // qApp->processEvents(); |
@@ -151,3 +157,3 @@ void NetworkDialog::timeSlot() { | |||
151 | void NetworkDialog::connectionTimeSlot() { | 157 | void NetworkDialog::connectionTimeSlot() { |
152 | // qDebug("Connections timed out"); | 158 | // odebug << "Connections timed out" << oendl; |
153 | // ftpQuit(); | 159 | // ftpQuit(); |
@@ -169,4 +175,4 @@ bool NetworkDialog::downloadFile( QString networkUrl ) | |||
169 | qApp->processEvents(); | 175 | qApp->processEvents(); |
170 | qDebug("Downloading: %s",networkUrl.latin1()); | 176 | odebug << "Downloading: " << networkUrl << "" << oendl; |
171 | qDebug("Into: %s",localFileName.latin1()); | 177 | odebug << "Into: " << localFileName << "" << oendl; |
172 | if( networkUrl.length() > 5) { | 178 | if( networkUrl.length() > 5) { |
@@ -176,3 +182,3 @@ bool NetworkDialog::downloadFile( QString networkUrl ) | |||
176 | if(ftp_host.length() < 2) { | 182 | if(ftp_host.length() < 2) { |
177 | qDebug("Please select an ftp host" ); | 183 | odebug << "Please select an ftp host" << oendl; |
178 | successDownload=false; | 184 | successDownload=false; |
@@ -182,4 +188,4 @@ bool NetworkDialog::downloadFile( QString networkUrl ) | |||
182 | QString msg; | 188 | QString msg; |
183 | qDebug(ftp_host); | 189 | odebug << ftp_host << oendl; |
184 | qDebug("Opening ftp connection."); | 190 | odebug << "Opening ftp connection." << oendl; |
185 | warnLabel->setText("connecting to: "+ftp_host ); | 191 | warnLabel->setText("connecting to: "+ftp_host ); |
@@ -202,3 +208,3 @@ bool NetworkDialog::downloadFile( QString networkUrl ) | |||
202 | } | 208 | } |
203 | qDebug("Changing directories."); | 209 | odebug << "Changing directories." << oendl; |
204 | TextLabel3->setText("Changing directories."); | 210 | TextLabel3->setText("Changing directories."); |
@@ -219,3 +225,3 @@ bool NetworkDialog::downloadFile( QString networkUrl ) | |||
219 | // } | 225 | // } |
220 | qDebug("Requesting directory list."); | 226 | odebug << "Requesting directory list." << oendl; |
221 | TextLabel3->setText("Getting directory list."); | 227 | TextLabel3->setText("Getting directory list."); |
@@ -234,3 +240,3 @@ bool NetworkDialog::downloadFile( QString networkUrl ) | |||
234 | QTextStream t( &tmp ); // use a text stream | 240 | QTextStream t( &tmp ); // use a text stream |
235 | qDebug("Finding partial filename "+s_partialFileName); | 241 | odebug << "Finding partial filename "+s_partialFileName << oendl; |
236 | while ( !t.eof()) { | 242 | while ( !t.eof()) { |
@@ -243,3 +249,3 @@ bool NetworkDialog::downloadFile( QString networkUrl ) | |||
243 | File_Name = str; | 249 | File_Name = str; |
244 | qDebug("Found file_name "+ File_Name); | 250 | odebug << "Found file_name "+ File_Name << oendl; |
245 | break; | 251 | break; |
@@ -248,6 +254,6 @@ bool NetworkDialog::downloadFile( QString networkUrl ) | |||
248 | // File_Name = str; | 254 | // File_Name = str; |
249 | // qDebug("Found file_name "+ File_Name); | 255 | // odebug << "Found file_name "+ File_Name << oendl; |
250 | // break; | 256 | // break; |
251 | // } | 257 | // } |
252 | 258 | ||
253 | } | 259 | } |
@@ -258,3 +264,3 @@ bool NetworkDialog::downloadFile( QString networkUrl ) | |||
258 | else | 264 | else |
259 | qDebug("Error opening temp file."); | 265 | odebug << "Error opening temp file." << oendl; |
260 | 266 | ||
@@ -265,4 +271,4 @@ bool NetworkDialog::downloadFile( QString networkUrl ) | |||
265 | localFileName = temp+File_Name; | 271 | localFileName = temp+File_Name; |
266 | qDebug("Requesting file "+ File_Name); | 272 | odebug << "Requesting file "+ File_Name << oendl; |
267 | qDebug( "Saving as "+localFileName); | 273 | odebug << "Saving as "+localFileName << oendl; |
268 | msg="Requesting file "+ File_Name; | 274 | msg="Requesting file "+ File_Name; |
@@ -274,5 +280,5 @@ bool NetworkDialog::downloadFile( QString networkUrl ) | |||
274 | QString temp; | 280 | QString temp; |
275 | temp.sprintf( File_Name+" "+" %dkb", fsz); | 281 | temp.sprintf( File_Name+" "+" %dkb", fsz); |
276 | TextLabel3->setText(temp); | 282 | TextLabel3->setText(temp); |
277 | 283 | ||
278 | ProgressBar1->setTotalSteps(fsz); | 284 | ProgressBar1->setTotalSteps(fsz); |
@@ -295,3 +301,3 @@ bool NetworkDialog::downloadFile( QString networkUrl ) | |||
295 | } | 301 | } |
296 | qDebug("Ftp session successful"); | 302 | odebug << "Ftp session successful" << oendl; |
297 | successDownload=TRUE; | 303 | successDownload=TRUE; |
@@ -304,3 +310,3 @@ bool NetworkDialog::downloadFile( QString networkUrl ) | |||
304 | void NetworkDialog::doOk() { | 310 | void NetworkDialog::doOk() { |
305 | qWarning("Do OK"); | 311 | owarn << "Do OK" << oendl; |
306 | QString loginStr; | 312 | QString loginStr; |
@@ -316,3 +322,3 @@ void NetworkDialog::doOk() { | |||
316 | successDownload = false; | 322 | successDownload = false; |
317 | reject(); | 323 | reject(); |
318 | } | 324 | } |
diff --git a/noncore/apps/opie-gutenbrowser/SearchDialog.cpp b/noncore/apps/opie-gutenbrowser/SearchDialog.cpp index 4ddb3f0..d989304 100644 --- a/noncore/apps/opie-gutenbrowser/SearchDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/SearchDialog.cpp | |||
@@ -100,3 +100,3 @@ void SearchDialog::byeBye() | |||
100 | searchString = get_text(); | 100 | searchString = get_text(); |
101 | // qDebug("Search string is "+searchString); | 101 | // odebug << "Search string is "+searchString << oendl; |
102 | Config cfg("Gutenbrowser"); | 102 | Config cfg("Gutenbrowser"); |
@@ -121,3 +121,3 @@ void SearchDialog::closed() | |||
121 | searchString = get_text(); | 121 | searchString = get_text(); |
122 | // qDebug("Search string is "+searchString); | 122 | // odebug << "Search string is "+searchString << oendl; |
123 | Config cfg("Gutenbrowser"); | 123 | Config cfg("Gutenbrowser"); |
diff --git a/noncore/apps/opie-gutenbrowser/browserDialog.cpp b/noncore/apps/opie-gutenbrowser/browserDialog.cpp index 81dd516..cc05d04 100644 --- a/noncore/apps/opie-gutenbrowser/browserDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/browserDialog.cpp | |||
@@ -12,2 +12,3 @@ copyright 2001 by L.J. Potter ljp@llornkcor.com | |||
12 | #include <opie2/ofiledialog.h> | 12 | #include <opie2/ofiledialog.h> |
13 | #include <opie2/odebug.h> | ||
13 | using namespace Opie::Ui; | 14 | using namespace Opie::Ui; |
@@ -54,3 +55,3 @@ void optionsDialog::BrowseSelected() { | |||
54 | // QStringList fileList=browseForFiles->fileList; | 55 | // QStringList fileList=browseForFiles->fileList; |
55 | // qDebug(selFile); | 56 | // odebug << selFile << oendl; |
56 | // QStringList::ConstIterator f; | 57 | // QStringList::ConstIterator f; |
@@ -78,3 +79,3 @@ void optionsDialog::setHttp(int index) { | |||
78 | config.setGroup( "HttpServer" ); | 79 | config.setGroup( "HttpServer" ); |
79 | qDebug("writing http server"); | 80 | odebug << "writing http server" << oendl; |
80 | if( index== 0) { | 81 | if( index== 0) { |
diff --git a/noncore/apps/opie-gutenbrowser/fontDialog.cpp b/noncore/apps/opie-gutenbrowser/fontDialog.cpp index a17b1d3..fa964a6 100644 --- a/noncore/apps/opie-gutenbrowser/fontDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/fontDialog.cpp | |||
@@ -92,3 +92,3 @@ void FontDialog::familyListBoxSlot(const QString & text) | |||
92 | family = text; | 92 | family = text; |
93 | // qDebug(family); | 93 | // odebug << family << oendl; |
94 | QStringList styles = fdb.styles( family ); // string list of styles of our current font family | 94 | QStringList styles = fdb.styles( family ); // string list of styles of our current font family |
@@ -102,3 +102,3 @@ QValueList<int> smoothies = fdb.smoothSizes( family, styleListBox->text(0) ); | |||
102 | dstyle = QString::number( *points ); | 102 | dstyle = QString::number( *points ); |
103 | qDebug(dstyle); | 103 | odebug << dstyle << oendl; |
104 | sizeComboBox->insertItem( dstyle.left( dstyle.length() - 1 )); | 104 | sizeComboBox->insertItem( dstyle.left( dstyle.length() - 1 )); |
@@ -153,3 +153,3 @@ void FontDialog::populateLists() | |||
153 | // if(family == defaultFont.family()) | 153 | // if(family == defaultFont.family()) |
154 | // qDebug(family); | 154 | // odebug << family << oendl; |
155 | familyListBox->insertItem( family); | 155 | familyListBox->insertItem( family); |
@@ -211,3 +211,3 @@ void FontDialog::changeText() | |||
211 | } | 211 | } |
212 | // qDebug("Font family is "+family); | 212 | // odebug << "Font family is "+family << oendl; |
213 | if( styleListBox->currentItem() == -1) | 213 | if( styleListBox->currentItem() == -1) |
@@ -217,3 +217,3 @@ void FontDialog::changeText() | |||
217 | } | 217 | } |
218 | // qDebug("font style is "+style); | 218 | // odebug << "font style is "+style << oendl; |
219 | 219 | ||
@@ -225,3 +225,3 @@ void FontDialog::changeText() | |||
225 | 225 | ||
226 | // qDebug("Font size is "+size); | 226 | // odebug << "Font size is "+size << oendl; |
227 | bool ok; | 227 | bool ok; |
@@ -233,3 +233,3 @@ void FontDialog::changeText() | |||
233 | charSet = *s; | 233 | charSet = *s; |
234 | // qDebug(charSet); | 234 | // odebug << charSet << oendl; |
235 | } | 235 | } |
@@ -237,5 +237,5 @@ void FontDialog::changeText() | |||
237 | QFontInfo fontInfo( selectedFont); | 237 | QFontInfo fontInfo( selectedFont); |
238 | // if(fontInfo.italic() ) qDebug("italic"); | 238 | // if(fontInfo.italic() ) odebug << "italic" << oendl; |
239 | selectedFont.setWeight(fontInfo.weight() ); | 239 | selectedFont.setWeight(fontInfo.weight() ); |
240 | // qDebug("Style are "+style+" %d ",fontInfo.weight()); | 240 | // odebug << "Style are "+style+" " << fontInfo.weight() << " " << oendl; |
241 | Config cfg("Gutenbrowser"); | 241 | Config cfg("Gutenbrowser"); |
@@ -251,3 +251,3 @@ void FontDialog::changeText() | |||
251 | cfg.writeEntry("Italic","TRUE"); | 251 | cfg.writeEntry("Italic","TRUE"); |
252 | // qDebug("Style is "+styleListBox->currentText()); | 252 | // odebug << "Style is "+styleListBox->currentText() << oendl; |
253 | } else | 253 | } else |
diff --git a/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp b/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp index ad770b5..a9c7346 100644 --- a/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp +++ b/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp | |||
@@ -13,2 +13,3 @@ | |||
13 | ***************************************************************************/ | 13 | ***************************************************************************/ |
14 | |||
14 | #include "optionsDialog.h" | 15 | #include "optionsDialog.h" |
@@ -18,11 +19,15 @@ | |||
18 | 19 | ||
20 | /* OPIE */ | ||
21 | #include <opie2/odebug.h> | ||
22 | #include <qpe/config.h> | ||
23 | |||
24 | /* QT */ | ||
19 | #include <qprogressbar.h> | 25 | #include <qprogressbar.h> |
20 | #include <stdlib.h> | ||
21 | #include <qurloperator.h> | 26 | #include <qurloperator.h> |
22 | #include <qpe/config.h> | ||
23 | #include <qlistbox.h> | 27 | #include <qlistbox.h> |
24 | 28 | ||
29 | /* STD */ | ||
30 | #include <stdlib.h> | ||
25 | #include <unistd.h> | 31 | #include <unistd.h> |
26 | #include <stdio.h> | 32 | #include <stdio.h> |
27 | #include <stdlib.h> | ||
28 | 33 | ||
@@ -40,3 +45,3 @@ void optionsDialog::ftpSiteDlg( ) | |||
40 | ListFile+="/ftpList"; | 45 | ListFile+="/ftpList"; |
41 | qDebug("opening "+ListFile); | 46 | odebug << "opening "+ListFile << oendl; |
42 | if ( QFile(ListFile).exists() ) { | 47 | if ( QFile(ListFile).exists() ) { |
@@ -78,3 +83,3 @@ void optionsDialog::getSite() | |||
78 | // { // use new, improved, *INSTANT* network-dialog-file-getterer | 83 | // { // use new, improved, *INSTANT* network-dialog-file-getterer |
79 | // qDebug("gitcha!"); | 84 | // odebug << "gitcha!" << oendl; |
80 | // } | 85 | // } |
@@ -86,3 +91,3 @@ void optionsDialog::getSite() | |||
86 | QString cmd="wget -T 15 -O " +outputFile + " " + networkUrl + " 2>&1" ; | 91 | QString cmd="wget -T 15 -O " +outputFile + " " + networkUrl + " 2>&1" ; |
87 | qDebug("Issuing the command "+cmd); | 92 | odebug << "Issuing the command "+cmd << oendl; |
88 | Output *outDlg; | 93 | Output *outDlg; |
@@ -101,3 +106,3 @@ void optionsDialog::getSite() | |||
101 | } | 106 | } |
102 | pclose(fp); | 107 | pclose(fp); |
103 | outDlg->close(); | 108 | outDlg->close(); |
@@ -105,3 +110,3 @@ void optionsDialog::getSite() | |||
105 | delete outDlg; | 110 | delete outDlg; |
106 | 111 | ||
107 | // outputFile=ListFile; | 112 | // outputFile=ListFile; |
@@ -115,3 +120,3 @@ bool optionsDialog::parseFtpList( QString outputFile) | |||
115 | // TODO: add locations!! | 120 | // TODO: add locations!! |
116 | qDebug("parse ftplist "+outputFile); | 121 | odebug << "parse ftplist "+outputFile << oendl; |
117 | QString ftpList, s_location; | 122 | QString ftpList, s_location; |
@@ -154,3 +159,3 @@ bool optionsDialog::parseFtpList( QString outputFile) | |||
154 | if(( start=s.find("<BR>(", 0, TRUE) ) != -1) { | 159 | if(( start=s.find("<BR>(", 0, TRUE) ) != -1) { |
155 | // qDebug("%s",s.latin1()); | 160 | // odebug << "" << s << "" << oendl; |
156 | end = s.find( ")", 0, TRUE)+1; | 161 | end = s.find( ")", 0, TRUE)+1; |
@@ -158,3 +163,3 @@ bool optionsDialog::parseFtpList( QString outputFile) | |||
158 | 163 | ||
159 | // qDebug("%s", s_location.latin1()); | 164 | // odebug << "" << s_location << "" << oendl; |
160 | // ftpList += ftpSite + "\n"; | 165 | // ftpList += ftpSite + "\n"; |
@@ -175,3 +180,3 @@ bool optionsDialog::parseFtpList( QString outputFile) | |||
175 | QFile f2( ListFile); | 180 | QFile f2( ListFile); |
176 | if(!f2.open( IO_ReadWrite | IO_Truncate)) | 181 | if(!f2.open( IO_ReadWrite | IO_Truncate)) |
177 | QMessageBox::message( (tr("Note")), (tr("File not opened sucessfully.\n"+ListFile )) ); | 182 | QMessageBox::message( (tr("Note")), (tr("File not opened sucessfully.\n"+ListFile )) ); |
@@ -192,3 +197,3 @@ void optionsDialog::openSiteList() { | |||
192 | 197 | ||
193 | qDebug(" just opens the ftp site list"); | 198 | odebug << " just opens the ftp site list" << oendl; |
194 | // ListFile = ( QDir::homeDirPath ()) +"/.gutenbrowser/ftpList"; | 199 | // ListFile = ( QDir::homeDirPath ()) +"/.gutenbrowser/ftpList"; |
@@ -232,3 +237,3 @@ void optionsDialog::select_site( const char *index ) | |||
232 | s_site2=s_site.right( s_site.length()-(s_site.find(" ",0,TRUE)+4) ); | 237 | s_site2=s_site.right( s_site.length()-(s_site.find(" ",0,TRUE)+4) ); |
233 | qDebug("Selected ftp site is "+ s_site2); | 238 | odebug << "Selected ftp site is "+ s_site2 << oendl; |
234 | int i_ftp = s_site2.find("/", 0, FALSE); | 239 | int i_ftp = s_site2.find("/", 0, FALSE); |
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp index 2a9a71e..be2b897 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp +++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp | |||
@@ -16,9 +16,3 @@ | |||
16 | // donate@gutenberg.net | 16 | // donate@gutenberg.net |
17 | #include <qpe/qpeapplication.h> | 17 | |
18 | #include <qpe/fontdatabase.h> | ||
19 | #include <qpe/config.h> | ||
20 | #include <qpe/qcopenvelope_qws.h> | ||
21 | #include <qpe/mimetype.h> | ||
22 | #include <qpe/resource.h> | ||
23 | #include <qpe/applnk.h> | ||
24 | 18 | ||
@@ -35,3 +29,13 @@ | |||
35 | 29 | ||
30 | /* OPIE */ | ||
31 | #include <opie2/odebug.h> | ||
32 | #include <qpe/qpeapplication.h> | ||
33 | #include <qpe/fontdatabase.h> | ||
34 | #include <qpe/config.h> | ||
35 | #include <qpe/qcopenvelope_qws.h> | ||
36 | #include <qpe/mimetype.h> | ||
37 | #include <qpe/resource.h> | ||
38 | #include <qpe/applnk.h> | ||
36 | 39 | ||
40 | /* QT */ | ||
37 | #include <qregexp.h> | 41 | #include <qregexp.h> |
@@ -53,2 +57,3 @@ | |||
53 | 57 | ||
58 | /* STD */ | ||
54 | #include <stdio.h> | 59 | #include <stdio.h> |
@@ -65,3 +70,3 @@ static const int fontsize[nfontsizes] = {8,9,10,11,12,13,14,18,24}; | |||
65 | Gutenbrowser::Gutenbrowser() | 70 | Gutenbrowser::Gutenbrowser() |
66 | Gutenbrowser(); | 71 | Gutenbrowser(); |
67 | #else | 72 | #else |
@@ -69,99 +74,99 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags ) | |||
69 | #endif | 74 | #endif |
70 | : QMainWindow() | 75 | : QMainWindow() |
71 | { | 76 | { |
72 | // QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 77 | // QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
73 | // QCopEnvelope e("QPE/System", "grabKeyboard(QString)" ); | 78 | // QCopEnvelope e("QPE/System", "grabKeyboard(QString)" ); |
74 | // e << ""; | 79 | // e << ""; |
75 | // QPEApplication::grabKeyboard(); | 80 | // QPEApplication::grabKeyboard(); |
76 | showMainList=TRUE; | 81 | showMainList=TRUE; |
77 | working=false; | 82 | working=false; |
78 | this->setUpdatesEnabled(TRUE); | 83 | this->setUpdatesEnabled(TRUE); |
79 | // #ifndef Q_WS_QWS | 84 | // #ifndef Q_WS_QWS |
80 | QString msg; | 85 | QString msg; |
81 | msg="You have now entered unto gutenbrowser,\n"; | 86 | msg="You have now entered unto gutenbrowser,\n"; |
82 | 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"; |
83 | 88 | ||
84 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; | 89 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; |
85 | setCaption("Gutenbrowser");// Embedded " VERSION); | 90 | setCaption("Gutenbrowser");// Embedded " VERSION); |
86 | this->setUpdatesEnabled(TRUE); | 91 | this->setUpdatesEnabled(TRUE); |
87 | 92 | ||
88 | // bool firstTime=FALSE; | 93 | // bool firstTime=FALSE; |
89 | topLayout = new QVBoxLayout( this, 0, 0, "topLayout"); | 94 | topLayout = new QVBoxLayout( this, 0, 0, "topLayout"); |
90 | 95 | ||
91 | menu = new QHBoxLayout(-1,"menu"); | 96 | menu = new QHBoxLayout(-1,"menu"); |
92 | buttons2 = new QHBoxLayout(-1,"buttons2"); | 97 | buttons2 = new QHBoxLayout(-1,"buttons2"); |
93 | edits = new QHBoxLayout(-1,"edits"); | 98 | edits = new QHBoxLayout(-1,"edits"); |
94 | 99 | ||
95 | useSplitter=TRUE; | 100 | useSplitter=TRUE; |
96 | 101 | ||
97 | initConfig(); | 102 | initConfig(); |
98 | initMenuBar(); | 103 | initMenuBar(); |
99 | initButtonBar(); | 104 | initButtonBar(); |
100 | initStatusBar(); | 105 | initStatusBar(); |
101 | initView(); | 106 | initView(); |
102 | initSlots(); | 107 | initSlots(); |
103 | 108 | ||
104 | QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold); | 109 | QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold); |
105 | 110 | ||
106 | connect( mainList, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint &)), | 111 | connect( mainList, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint &)), |
107 | this, SLOT( mainListPressed(int, QListBoxItem *, const QPoint &)) ); | 112 | this, SLOT( mainListPressed(int, QListBoxItem *, const QPoint &)) ); |
108 | if( useIcons) | 113 | if( useIcons) |
109 | toggleButtonIcons( TRUE); | 114 | toggleButtonIcons( TRUE); |
110 | else | 115 | else |
111 | toggleButtonIcons( FALSE); | 116 | toggleButtonIcons( FALSE); |
112 | 117 | ||
113 | enableButtons(false); | 118 | enableButtons(false); |
114 | 119 | ||
115 | Config config("Gutenbrowser"); // populate menubuttonlist | 120 | Config config("Gutenbrowser"); // populate menubuttonlist |
116 | config.setGroup("General"); | 121 | config.setGroup("General"); |
117 | 122 | ||
118 | config.setGroup( "Files" ); | 123 | config.setGroup( "Files" ); |
119 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); | 124 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); |
120 | int i_numofFiles = s_numofFiles.toInt(); | 125 | int i_numofFiles = s_numofFiles.toInt(); |
121 | 126 | ||
122 | QString tempFileName; | 127 | QString tempFileName; |
123 | 128 | ||
124 | for (int i = 0; i <= i_numofFiles; i++) { | 129 | for (int i = 0; i <= i_numofFiles; i++) { |
125 | // tempFileName.setNum(i); | 130 | // tempFileName.setNum(i); |
126 | config.setGroup( "Files" ); | 131 | config.setGroup( "Files" ); |
127 | QString ramble = config.readEntry( QString::number(i), "" ); | 132 | QString ramble = config.readEntry( QString::number(i), "" ); |
128 | 133 | ||
129 | config.setGroup( "Titles" ); | 134 | config.setGroup( "Titles" ); |
130 | QString tempTitle = config.readEntry( ramble, ""); | 135 | QString tempTitle = config.readEntry( ramble, ""); |
131 | config.setGroup( tempTitle); | 136 | config.setGroup( tempTitle); |
132 | int index=config.readNumEntry( "LineNumber", -1 ); | 137 | int index=config.readNumEntry( "LineNumber", -1 ); |
133 | if( index != -1) { | 138 | if( index != -1) { |
134 | // qDebug( tempTitle); | 139 | // odebug << tempTitle << oendl; |
135 | bookmarksMenu->insertItem( tempTitle); | 140 | bookmarksMenu->insertItem( tempTitle); |
136 | } | 141 | } |
137 | } | 142 | } |
138 | 143 | ||
139 | // QString gutenIndex= local_library + "GUTINDEX.ALL"; | 144 | // QString gutenIndex= local_library + "GUTINDEX.ALL"; |
140 | QString gutenIndex= QPEApplication::qpeDir()+ "/etc/gutenbrowser/GUTINDEX.ALL"; | 145 | QString gutenIndex= QPEApplication::qpeDir()+ "/etc/gutenbrowser/GUTINDEX.ALL"; |
141 | 146 | ||
142 | if( QFile( gutenIndex).exists() ) { | 147 | if( QFile( gutenIndex).exists() ) { |
143 | indexLib.setName( gutenIndex); | 148 | indexLib.setName( gutenIndex); |
144 | } else { | 149 | } else { |
145 | QString localLibIndexFile = QPEApplication::qpeDir()+ "/etc/gutenbrowser/PGWHOLE.TXT"; | 150 | QString localLibIndexFile = QPEApplication::qpeDir()+ "/etc/gutenbrowser/PGWHOLE.TXT"; |
146 | // QString localLibIndexFile= local_library + "PGWHOLE.TXT"; | 151 | // QString localLibIndexFile= local_library + "PGWHOLE.TXT"; |
147 | newindexLib.setName( localLibIndexFile); | 152 | newindexLib.setName( localLibIndexFile); |
148 | } | 153 | } |
149 | LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */); | 154 | LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */); |
150 | loadCheck=false; | 155 | loadCheck=false; |
151 | chdir(local_library); | 156 | chdir(local_library); |
152 | if(!showMainList) { | 157 | if(!showMainList) { |
153 | Lview->setFocus(); | 158 | Lview->setFocus(); |
154 | // if(firstTime) | 159 | // if(firstTime) |
155 | // Bookmark(); | 160 | // Bookmark(); |
156 | for (int i=1;i< qApp->argc();i++) { | 161 | for (int i=1;i< qApp->argc();i++) { |
157 | qDebug("Suppose we open somethin"); | 162 | odebug << "Suppose we open somethin" << oendl; |
158 | load(qApp->argv()[i]); | 163 | load(qApp->argv()[i]); |
159 | } | 164 | } |
160 | } else { | 165 | } else { |
161 | fillWithTitles(); | 166 | fillWithTitles(); |
162 | mainList->setFocus(); | 167 | mainList->setFocus(); |
163 | // mainList->setCurrentItem(0); | 168 | // mainList->setCurrentItem(0); |
164 | 169 | ||
165 | } | 170 | } |
166 | writeConfig(); | 171 | writeConfig(); |
167 | } //end init | 172 | } //end init |
@@ -169,5 +174,5 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags ) | |||
169 | Gutenbrowser::~Gutenbrowser() { | 174 | Gutenbrowser::~Gutenbrowser() { |
170 | // QPEApplication::grabKeyboard(); | 175 | // QPEApplication::grabKeyboard(); |
171 | // QPEApplication::ungrabKeyboard(); | 176 | // QPEApplication::ungrabKeyboard(); |
172 | qDebug("Exit"); | 177 | odebug << "Exit" << oendl; |
173 | } | 178 | } |
@@ -175,14 +180,14 @@ Gutenbrowser::~Gutenbrowser() { | |||
175 | /* | 180 | /* |
176 | Google.com search */ | 181 | Google.com search */ |
177 | void Gutenbrowser::InfoBarClick() { | 182 | void Gutenbrowser::InfoBarClick() { |
178 | QString text; | 183 | QString text; |
179 | if( Lview->hasSelectedText()) { | 184 | if( Lview->hasSelectedText()) { |
180 | Lview->copy(); | 185 | Lview->copy(); |
181 | QClipboard *cb = QApplication::clipboard(); | 186 | QClipboard *cb = QApplication::clipboard(); |
182 | text = cb->text(); | 187 | text = cb->text(); |
183 | } else { | 188 | } else { |
184 | // text=title; | 189 | // text=title; |
185 | text=this->caption(); | 190 | text=this->caption(); |
186 | } | 191 | } |
187 | searchGoogle(text); | 192 | searchGoogle(text); |
188 | } | 193 | } |
@@ -190,73 +195,73 @@ void Gutenbrowser::InfoBarClick() { | |||
190 | /* | 195 | /* |
191 | download http with wget or preferred browser */ | 196 | download http with wget or preferred browser */ |
192 | void Gutenbrowser::goGetit( const QString &url, bool showMsg) { | 197 | void Gutenbrowser::goGetit( const QString &url, bool showMsg) { |
193 | // int eexit=0; | 198 | // int eexit=0; |
194 | QString cmd; | 199 | QString cmd; |
195 | // config.read(); | 200 | // config.read(); |
196 | qApp->processEvents(); | 201 | qApp->processEvents(); |
197 | QString filename = QPEApplication::qpeDir(); | 202 | QString filename = QPEApplication::qpeDir(); |
198 | if(filename.right(1)!="/") | 203 | if(filename.right(1)!="/") |
199 | filename+="/etc/gutenbrowser/"; | 204 | filename+="/etc/gutenbrowser/"; |
200 | else | 205 | else |
201 | filename+="etc/gutenbrowser/"; | 206 | filename+="etc/gutenbrowser/"; |
202 | qDebug("filename "+filename); | 207 | odebug << "filename "+filename << oendl; |
203 | // QString filename = QDir::homeDirPath()+"/Applications/gutenbrowser/"; | 208 | // QString filename = QDir::homeDirPath()+"/Applications/gutenbrowser/"; |
204 | 209 | ||
205 | filename += url.right( url.length() - url.findRev("/",-1,TRUE) -1); | 210 | filename += url.right( url.length() - url.findRev("/",-1,TRUE) -1); |
206 | 211 | ||
207 | Config config("Gutenbrowser"); | 212 | Config config("Gutenbrowser"); |
208 | config.setGroup( "Browser" ); | 213 | config.setGroup( "Browser" ); |
209 | QString brow = config.readEntry("Preferred", "Opera"); | 214 | QString brow = config.readEntry("Preferred", "Opera"); |
210 | qDebug("Preferred browser is "+brow); | 215 | odebug << "Preferred browser is "+brow << oendl; |
211 | if(!showMsg) { //if we just get the gutenindex.all | 216 | if(!showMsg) { //if we just get the gutenindex.all |
212 | cmd="wget -O " + filename +" " + url+" 2>&1" ; | 217 | cmd="wget -O " + filename +" " + url+" 2>&1" ; |
213 | chdir(local_library); | 218 | chdir(local_library); |
214 | qDebug("Issuing the system command: %s", cmd.latin1()); | 219 | odebug << "Issuing the system command: " << cmd << "" << oendl; |
215 | 220 | ||
216 | Output *outDlg; | 221 | Output *outDlg; |
217 | outDlg = new Output(this, tr("Gutenbrowser Output"),FALSE); | 222 | outDlg = new Output(this, tr("Gutenbrowser Output"),FALSE); |
218 | outDlg->showMaximized(); | 223 | outDlg->showMaximized(); |
219 | outDlg->show(); | 224 | outDlg->show(); |
220 | qApp->processEvents(); | 225 | qApp->processEvents(); |
221 | FILE *fp; | 226 | FILE *fp; |
222 | char line[130]; | 227 | char line[130]; |
223 | outDlg->OutputEdit->append( tr("Running wget") ); | 228 | outDlg->OutputEdit->append( tr("Running wget") ); |
224 | sleep(1); | 229 | sleep(1); |
225 | fp = popen( (const char *) cmd, "r"); | 230 | fp = popen( (const char *) cmd, "r"); |
226 | // qDebug("Issuing the command\n"+cmd); | 231 | // odebug << "Issuing the command\n"+cmd << oendl; |
227 | // system(cmd); | 232 | // system(cmd); |
228 | while ( fgets( line, sizeof line, fp)) { | 233 | while ( fgets( line, sizeof line, fp)) { |
229 | outDlg->OutputEdit->append(line); | 234 | outDlg->OutputEdit->append(line); |
230 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 235 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
231 | } | 236 | } |
232 | pclose(fp); | 237 | pclose(fp); |
233 | outDlg->close(); | 238 | outDlg->close(); |
234 | if(outDlg) | 239 | if(outDlg) |
235 | delete outDlg; | 240 | delete outDlg; |
236 | } else { | 241 | } else { |
237 | if( brow == "Konq") { | 242 | if( brow == "Konq") { |
238 | cmd = "konqueror "+url+" &"; | 243 | cmd = "konqueror "+url+" &"; |
239 | } | 244 | } |
240 | if( brow == "Opera") { //for desktop testing | 245 | if( brow == "Opera") { //for desktop testing |
241 | cmd = "opera "+url+" &"; | 246 | cmd = "opera "+url+" &"; |
242 | } | 247 | } |
243 | // if( brow == "Opera") { // on Zaurus | 248 | // if( brow == "Opera") { // on Zaurus |
244 | // cmd = "operagui "+url+" &"; | 249 | // cmd = "operagui "+url+" &"; |
245 | // } | 250 | // } |
246 | if( brow == "Mozilla") { | 251 | if( brow == "Mozilla") { |
247 | cmd = "mozilla "+url+" &"; | 252 | cmd = "mozilla "+url+" &"; |
248 | } | 253 | } |
249 | if( brow == "Netscape") { | 254 | if( brow == "Netscape") { |
250 | cmd = "netscape "+url+" &"; | 255 | cmd = "netscape "+url+" &"; |
251 | } | 256 | } |
252 | if(brow == "wget") { | 257 | if(brow == "wget") { |
253 | // cmd="wget -q "+url+" &"; | 258 | // cmd="wget -q "+url+" &"; |
254 | QString tempHtml=local_library+"webster.html"; | 259 | QString tempHtml=local_library+"webster.html"; |
255 | cmd="wget -O "+tempHtml+" -q "+url; | 260 | cmd="wget -O "+tempHtml+" -q "+url; |
256 | } | 261 | } |
257 | 262 | ||
258 | chdir(local_library); | 263 | chdir(local_library); |
259 | qDebug("Issuing the sys command: %s", cmd.latin1()); | 264 | odebug << "Issuing the sys command: " << cmd << "" << oendl; |
260 | system(cmd); | 265 | system(cmd); |
261 | } | 266 | } |
262 | } | 267 | } |
@@ -264,19 +269,19 @@ void Gutenbrowser::goGetit( const QString &url, bool showMsg) { | |||
264 | void Gutenbrowser::toggleButtonIcons( bool useEm) { | 269 | void Gutenbrowser::toggleButtonIcons( bool useEm) { |
265 | QString pixDir; | 270 | QString pixDir; |
266 | if(useEm) | 271 | if(useEm) |
267 | useEm=TRUE; | 272 | useEm=TRUE; |
268 | pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser"; | 273 | pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser"; |
269 | qDebug("Docdir is "+QPEApplication::documentDir()); | 274 | odebug << "Docdir is "+QPEApplication::documentDir() << oendl; |
270 | 275 | ||
271 | if( useIcons && QDir( pixDir).exists() ) { | 276 | if( useIcons && QDir( pixDir).exists() ) { |
272 | LibraryButton->setPixmap( Resource::loadPixmap("home") ); //in inline | 277 | LibraryButton->setPixmap( Resource::loadPixmap("home") ); //in inline |
273 | OpenButton->setPixmap( Resource::loadPixmap("gutenbrowser/openbook")); | 278 | OpenButton->setPixmap( Resource::loadPixmap("gutenbrowser/openbook")); |
274 | ForwardButton->setPixmap( Resource::loadPixmap("forward"));//in inline | 279 | ForwardButton->setPixmap( Resource::loadPixmap("forward"));//in inline |
275 | BackButton->setPixmap( Resource::loadPixmap("back") );//in inline | 280 | BackButton->setPixmap( Resource::loadPixmap("back") );//in inline |
276 | SearchButton->setPixmap( Resource::loadPixmap("gutenbrowser/search") );//in inline | 281 | SearchButton->setPixmap( Resource::loadPixmap("gutenbrowser/search") );//in inline |
277 | lastBmkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark_folder")); | 282 | lastBmkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark_folder")); |
278 | setBookmarkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark") ); | 283 | setBookmarkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark") ); |
279 | dictionaryButton->setPixmap( Resource::loadPixmap("gutenbrowser/spellcheck") ); | 284 | dictionaryButton->setPixmap( Resource::loadPixmap("gutenbrowser/spellcheck") ); |
280 | InfoBar->setPixmap( Resource::loadPixmap("gutenbrowser/google")); | 285 | InfoBar->setPixmap( Resource::loadPixmap("gutenbrowser/google")); |
281 | } | 286 | } |
282 | } | 287 | } |
@@ -286,10 +291,10 @@ bool Gutenbrowser::queryExit() | |||
286 | { | 291 | { |
287 | int exit=QMessageBox::information(this, "Quit...", "Do your really want to quit?", | 292 | int exit=QMessageBox::information(this, "Quit...", "Do your really want to quit?", |
288 | QMessageBox::Ok, QMessageBox::Cancel); | 293 | QMessageBox::Ok, QMessageBox::Cancel); |
289 | if (exit==1) { | 294 | if (exit==1) { |
290 | writeConfig(); | 295 | writeConfig(); |
291 | qApp->quit(); | 296 | qApp->quit(); |
292 | } else { | 297 | } else { |
293 | }; | 298 | }; |
294 | return (exit==1); | 299 | return (exit==1); |
295 | } | 300 | } |
@@ -302,8 +307,8 @@ void Gutenbrowser::slotFilePrint() { | |||
302 | void Gutenbrowser::ByeBye() { | 307 | void Gutenbrowser::ByeBye() { |
303 | if (b_queryExit) | 308 | if (b_queryExit) |
304 | queryExit(); | 309 | queryExit(); |
305 | else { | 310 | else { |
306 | // writeConfig(); | 311 | // writeConfig(); |
307 | qApp->quit(); | 312 | qApp->quit(); |
308 | } | 313 | } |
309 | } | 314 | } |
@@ -311,5 +316,5 @@ void Gutenbrowser::ByeBye() { | |||
311 | void Gutenbrowser::HelpBtn() { | 316 | void Gutenbrowser::HelpBtn() { |
312 | HelpMe* HelpDlg; | 317 | HelpMe* HelpDlg; |
313 | HelpDlg = new HelpMe( this, "Help Dialog"); | 318 | HelpDlg = new HelpMe( this, "Help Dialog"); |
314 | HelpDlg->showMaximized(); | 319 | HelpDlg->showMaximized(); |
315 | } | 320 | } |
@@ -318,21 +323,21 @@ void Gutenbrowser::DownloadIndex() { | |||
318 | #ifndef Q_WS_QWS | 323 | #ifndef Q_WS_QWS |
319 | { | 324 | { |
320 | switch( QMessageBox::information( 0, (tr("Download Library Index, or FTP sites?")), | 325 | switch( QMessageBox::information( 0, (tr("Download Library Index, or FTP sites?")), |
321 | (tr("Do you want to download the newest\n" | 326 | (tr("Do you want to download the newest\n" |
322 | "Project Gutenberg Library Index?\n" | 327 | "Project Gutenberg Library Index?\n" |
323 | "or select an ftp site?\n")), | 328 | "or select an ftp site?\n")), |
324 | (tr("&Library Index")), (tr("&Ftp Site")), (tr("&Cancel")), 2, 2 ) ) | 329 | (tr("&Library Index")), (tr("&Ftp Site")), (tr("&Cancel")), 2, 2 ) ) |
325 | { | 330 | { |
326 | case 0: // index clicked, | 331 | case 0: // index clicked, |
327 | downloadLibIndex(); | 332 | downloadLibIndex(); |
328 | break; | 333 | break; |
329 | 334 | ||
330 | case 1: // ftp selected | 335 | case 1: // ftp selected |
331 | downloadFtpList(); | 336 | downloadFtpList(); |
332 | break; | 337 | break; |
333 | 338 | ||
334 | case 2: // Cancel | 339 | case 2: // Cancel |
335 | break; | 340 | break; |
336 | }; | 341 | }; |
337 | } | 342 | } |
338 | #endif | 343 | #endif |
@@ -342,10 +347,10 @@ void Gutenbrowser::DownloadIndex() { | |||
342 | void Gutenbrowser::downloadFtpList() { | 347 | void Gutenbrowser::downloadFtpList() { |
343 | // QString cmd="wget http://www.promo.net/pg/list.html"); | 348 | // QString cmd="wget http://www.promo.net/pg/list.html"); |
344 | //system(cmd); | 349 | //system(cmd); |
345 | qApp->processEvents(); | 350 | qApp->processEvents(); |
346 | optionsDialog* optDlg; | 351 | optionsDialog* optDlg; |
347 | optDlg = new optionsDialog( this,"Options_Dlg", true); | 352 | optDlg = new optionsDialog( this,"Options_Dlg", true); |
348 | optDlg->getSite(); | 353 | optDlg->getSite(); |
349 | if(optDlg) | 354 | if(optDlg) |
350 | delete optDlg; | 355 | delete optDlg; |
351 | } | 356 | } |
@@ -354,23 +359,23 @@ void Gutenbrowser::downloadFtpList() { | |||
354 | void Gutenbrowser::downloadLibIndex() { | 359 | void Gutenbrowser::downloadLibIndex() { |
355 | // QString dwmloader = local_library + "pgwhole.zip"; | 360 | // QString dwmloader = local_library + "pgwhole.zip"; |
356 | // QString cmd = "lynx -source http://www.gutenberg.net/pgwhole.zip | cat >> " + dwmloader; | 361 | // QString cmd = "lynx -source http://www.gutenberg.net/pgwhole.zip | cat >> " + dwmloader; |
357 | // system(cmd); | 362 | // system(cmd); |
358 | 363 | ||
359 | // QString outputFile= local_library+ "GUTINDEX.ALL"; | 364 | // QString outputFile= local_library+ "GUTINDEX.ALL"; |
360 | // config.setGroup( "FTPsite" ); // ftp server config | 365 | // config.setGroup( "FTPsite" ); // ftp server config |
361 | // ftp_host=config.readEntry("SiteName", ""); | 366 | // ftp_host=config.readEntry("SiteName", ""); |
362 | // ftp_base_dir= config.readEntry("base", ""); | 367 | // ftp_base_dir= config.readEntry("base", ""); |
363 | // QString networkUrl= "ftp://"+ftp_host+ftp_base_dir+"/GUTINDEX.ALL"; | 368 | // QString networkUrl= "ftp://"+ftp_host+ftp_base_dir+"/GUTINDEX.ALL"; |
364 | QDir dir( local_library); | 369 | QDir dir( local_library); |
365 | dir.cd("", TRUE); | 370 | dir.cd("", TRUE); |
366 | goGetit( "http://sailor.gutenberg.org/GUTINDEX.ALL", false); // until ghttp works on binaries -qt3 | 371 | goGetit( "http://sailor.gutenberg.org/GUTINDEX.ALL", false); // until ghttp works on binaries -qt3 |
367 | // goGetit( "http://www.gutenberg.net/pgwhole.zip", true); // until ghttp works on binaries -qt3 | 372 | // goGetit( "http://www.gutenberg.net/pgwhole.zip", true); // until ghttp works on binaries -qt3 |
368 | // NetworkDialog *NetworkDlg; | 373 | // NetworkDialog *NetworkDlg; |
369 | // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkUrl, outputFile ); | 374 | // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkUrl, outputFile ); |
370 | // if( NetworkDlg->exec() != 0 ) | 375 | // if( NetworkDlg->exec() != 0 ) |
371 | // { // use new, improved, *INSTANT* network-dialog-file-getterer | 376 | // { // use new, improved, *INSTANT* network-dialog-file-getterer |
372 | //// QMessageBox::message("Note",""); | 377 | //// QMessageBox::message("Note",""); |
373 | // } | 378 | // } |
374 | // if(NetworkDlg) | 379 | // if(NetworkDlg) |
375 | // delete NetworkDlg; | 380 | // delete NetworkDlg; |
376 | } | 381 | } |
@@ -382,8 +387,8 @@ void Gutenbrowser::PrintBtn() { | |||
382 | void Gutenbrowser::SearchBtn() { | 387 | void Gutenbrowser::SearchBtn() { |
383 | if( loadCheck) { | 388 | if( loadCheck) { |
384 | qDebug("loadCheck: we have a loaded doc"); | 389 | odebug << "loadCheck: we have a loaded doc" << oendl; |
385 | Search(); | 390 | Search(); |
386 | } | 391 | } |
387 | // else | 392 | // else |
388 | // QMessageBox::message("Note","Sorry, can't search. No etext is loaded"); | 393 | // QMessageBox::message("Note","Sorry, can't search. No etext is loaded"); |
389 | } | 394 | } |
@@ -393,50 +398,50 @@ void Gutenbrowser::ForwardBtn() { | |||
393 | 398 | ||
394 | if( !ForwardButton->autoRepeat() && !ForwardButton->isDown()) { | 399 | if( !ForwardButton->autoRepeat() && !ForwardButton->isDown()) { |
395 | 400 | ||
396 | QString s; | 401 | QString s; |
397 | QString insertString; | 402 | QString insertString; |
398 | int pageSize= Lview->PageSize(); | 403 | int pageSize= Lview->PageSize(); |
399 | Lview->clear(); | 404 | Lview->clear(); |
400 | 405 | ||
401 | for(int fd=0; fd < pageSize - 1;fd++) { | 406 | for(int fd=0; fd < pageSize - 1;fd++) { |
402 | f.readLine(s, 256); | 407 | f.readLine(s, 256); |
403 | if(useWrap) | 408 | if(useWrap) |
404 | s.replace(QRegExp("\n"),""); | 409 | s.replace(QRegExp("\n"),""); |
405 | insertString+=s; | 410 | insertString+=s; |
406 | Lview->insertLine( s, -1); | 411 | Lview->insertLine( s, -1); |
407 | // qDebug(s); | 412 | // odebug << s << oendl; |
408 | currentLine++; | 413 | currentLine++; |
409 | } | 414 | } |
410 | // Lview->insertAt( insertString,0,0, FALSE); | 415 | // Lview->insertAt( insertString,0,0, FALSE); |
411 | currentFilePos = f.at(); | 416 | currentFilePos = f.at(); |
412 | // if( i_pageNum != pages) { | 417 | // if( i_pageNum != pages) { |
413 | // Lview->MultiLine_Ex::pageDown( FALSE); | 418 | // Lview->MultiLine_Ex::pageDown( FALSE); |
414 | i_pageNum++; | 419 | i_pageNum++; |
415 | pageStopArray.resize(i_pageNum + 1); | 420 | pageStopArray.resize(i_pageNum + 1); |
416 | // int length = Lview->length(); | 421 | // int length = Lview->length(); |
417 | 422 | ||
418 | pageStopArray[i_pageNum ] = currentFilePos; | 423 | pageStopArray[i_pageNum ] = currentFilePos; |
419 | // qDebug("%d current page is number %d, pagesize %d, length %d, current %d", | 424 | // qDebug("%d current page is number %d, pagesize %d, length %d, current %d", |
420 | // currentFilePos, i_pageNum, pageSize, Lview->length(), pageStopArray[i_pageNum] ); | 425 | // currentFilePos, i_pageNum, pageSize, Lview->length(), pageStopArray[i_pageNum] ); |
421 | setStatus(); | 426 | setStatus(); |
422 | Lview->setCursorPosition( 0, 0, FALSE); | 427 | Lview->setCursorPosition( 0, 0, FALSE); |
423 | // } | 428 | // } |
424 | 429 | ||
425 | } else { | 430 | } else { |
426 | // qDebug("bal"); | 431 | // odebug << "bal" << oendl; |
427 | // if( i_pageNum != pages) { | 432 | // if( i_pageNum != pages) { |
428 | 433 | ||
429 | // // int newTop = Lview->Top(); | 434 | // // int newTop = Lview->Top(); |
430 | // // if(Lview->lastRow() > i) | 435 | // // if(Lview->lastRow() > i) |
431 | // Lview->ScrollUp(1); | 436 | // Lview->ScrollUp(1); |
432 | // // i_pageNum++; | 437 | // // i_pageNum++; |
433 | // setStatus(); | 438 | // setStatus(); |
434 | // Lview->setCursorPosition( Lview->Top(), 0, FALSE); | 439 | // Lview->setCursorPosition( Lview->Top(), 0, FALSE); |
435 | 440 | ||
436 | // } | 441 | // } |
437 | 442 | ||
438 | } | 443 | } |
439 | Lview->setFocus(); | 444 | Lview->setFocus(); |
440 | 445 | ||
441 | // qDebug("page number %d line number %d", i_pageNum, currentLine); | 446 | // odebug << "page number " << i_pageNum << " line number " << currentLine << "" << oendl; |
442 | } | 447 | } |
@@ -445,58 +450,58 @@ void Gutenbrowser::ForwardBtn() { | |||
445 | void Gutenbrowser::BackBtn() { | 450 | void Gutenbrowser::BackBtn() { |
446 | if( i_pageNum > 0) { | 451 | if( i_pageNum > 0) { |
447 | int pageSize= Lview->PageSize(); | 452 | int pageSize= Lview->PageSize(); |
448 | // int length=Lview->length(); | 453 | // int length=Lview->length(); |
449 | 454 | ||
450 | i_pageNum--; | 455 | i_pageNum--; |
451 | currentFilePos = f.at(); | 456 | currentFilePos = f.at(); |
452 | 457 | ||
453 | // qDebug("%d move back to %d, current page number %d, %d, length %d", | 458 | // qDebug("%d move back to %d, current page number %d, %d, length %d", |
454 | // currentFilePos, pageStopArray[i_pageNum - 1 ], i_pageNum, pageSize, Lview->length() ); | 459 | // currentFilePos, pageStopArray[i_pageNum - 1 ], i_pageNum, pageSize, Lview->length() ); |
455 | 460 | ||
456 | if( i_pageNum < 2) { | 461 | if( i_pageNum < 2) { |
457 | f.at( 0); | 462 | f.at( 0); |
458 | } else { | 463 | } else { |
459 | if(!f.at( pageStopArray[i_pageNum - 1] )) | 464 | if(!f.at( pageStopArray[i_pageNum - 1] )) |
460 | qDebug("File positioned backward did not work"); | 465 | odebug << "File positioned backward did not work" << oendl; |
461 | } | 466 | } |
462 | QString s; | 467 | QString s; |
463 | // int sizeLine=0; | 468 | // int sizeLine=0; |
464 | Lview->clear(); | 469 | Lview->clear(); |
465 | // QString insertString; | 470 | // QString insertString; |
466 | 471 | ||
467 | for(int fd = 0; fd < pageSize ;fd++) { | 472 | for(int fd = 0; fd < pageSize ;fd++) { |
468 | // Lview->removeLine( Lview->PageSize() ); | 473 | // Lview->removeLine( Lview->PageSize() ); |
469 | f.readLine(s, 256); | 474 | f.readLine(s, 256); |
470 | if(useWrap) | 475 | if(useWrap) |
471 | s.replace(QRegExp("\n"),""); | 476 | s.replace(QRegExp("\n"),""); |
472 | currentLine++; | 477 | currentLine++; |
473 | // insertString+=s; | 478 | // insertString+=s; |
474 | Lview->insertLine( s, -1); | 479 | Lview->insertLine( s, -1); |
475 | } | 480 | } |
476 | 481 | ||
477 | // Lview->insertAt( insertString,0,0, FALSE); | 482 | // Lview->insertAt( insertString,0,0, FALSE); |
478 | 483 | ||
479 | if( !BackButton->autoRepeat() && !BackButton->isDown()) { | 484 | if( !BackButton->autoRepeat() && !BackButton->isDown()) { |
480 | QString topR; | 485 | QString topR; |
481 | QString lastR; | 486 | QString lastR; |
482 | QString pageR; | 487 | QString pageR; |
483 | // int sizer = Lview->lastRow() - Lview->topRow(); | 488 | // int sizer = Lview->lastRow() - Lview->topRow(); |
484 | // int i_topRow = Lview->topRow(); | 489 | // int i_topRow = Lview->topRow(); |
485 | if( i_pageNum < 1) | 490 | if( i_pageNum < 1) |
486 | i_pageNum = 1; | 491 | i_pageNum = 1; |
487 | setCaption(QString::number(i_pageNum)); | 492 | setCaption(QString::number(i_pageNum)); |
488 | } else { | 493 | } else { |
489 | // int newTop = Lview->Top(); | 494 | // int newTop = Lview->Top(); |
490 | // if(Lview->lastRow() > i) | 495 | // if(Lview->lastRow() > i) |
491 | Lview->MultiLine_Ex::pageUp( FALSE); | 496 | Lview->MultiLine_Ex::pageUp( FALSE); |
492 | // Lview->ScrollDown(1); | 497 | // Lview->ScrollDown(1); |
493 | // i_pageNum--; | 498 | // i_pageNum--; |
494 | if( i_pageNum < 1) | 499 | if( i_pageNum < 1) |
495 | i_pageNum = 1; | 500 | i_pageNum = 1; |
496 | setStatus(); | 501 | setStatus(); |
497 | Lview->setCursorPosition( Lview->Top(), 0, FALSE); | 502 | Lview->setCursorPosition( Lview->Top(), 0, FALSE); |
498 | 503 | ||
499 | } | 504 | } |
500 | } | 505 | } |
501 | Lview->setFocus(); | 506 | Lview->setFocus(); |
502 | } | 507 | } |
@@ -504,6 +509,6 @@ void Gutenbrowser::BackBtn() { | |||
504 | void Gutenbrowser::doBeginBtn() { | 509 | void Gutenbrowser::doBeginBtn() { |
505 | if(loadCheck) { | 510 | if(loadCheck) { |
506 | qApp->processEvents(); | 511 | qApp->processEvents(); |
507 | BeginBtn(); | 512 | BeginBtn(); |
508 | } | 513 | } |
509 | } | 514 | } |
@@ -513,25 +518,25 @@ void Gutenbrowser::TopBtn() { | |||
513 | 518 | ||
514 | if(loadCheck) { | 519 | if(loadCheck) { |
515 | if( i_pageNum != 0) { | 520 | if( i_pageNum != 0) { |
516 | qDebug("top"); | 521 | odebug << "top" << oendl; |
517 | qApp->processEvents(); | 522 | qApp->processEvents(); |
518 | currentLine = 0; | 523 | currentLine = 0; |
519 | i_pageNum = 1; | 524 | i_pageNum = 1; |
520 | int pageSize = Lview->PageSize() ; | 525 | int pageSize = Lview->PageSize() ; |
521 | Lview->clear(); | 526 | Lview->clear(); |
522 | QString s; | 527 | QString s; |
523 | f.at(0); | 528 | f.at(0); |
524 | for(int fd=0; fd < pageSize ;fd++) { | 529 | for(int fd=0; fd < pageSize ;fd++) { |
525 | f.readLine(s, 256); | 530 | f.readLine(s, 256); |
526 | if(useWrap) | 531 | if(useWrap) |
527 | s.replace(QRegExp("\n"),""); | 532 | s.replace(QRegExp("\n"),""); |
528 | Lview->insertLine(s ,-1); | 533 | Lview->insertLine(s ,-1); |
529 | currentLine++; | 534 | currentLine++; |
530 | } | 535 | } |
531 | Lview->setCursorPosition( 0,0, FALSE); | 536 | Lview->setCursorPosition( 0,0, FALSE); |
532 | i_pageNum=1; | 537 | i_pageNum=1; |
533 | setStatus(); | 538 | setStatus(); |
534 | } | 539 | } |
535 | Lview->setFocus(); | 540 | Lview->setFocus(); |
536 | } | 541 | } |
537 | } | 542 | } |
@@ -540,69 +545,69 @@ void Gutenbrowser::TopBtn() { | |||
540 | void Gutenbrowser::BeginBtn() { | 545 | void Gutenbrowser::BeginBtn() { |
541 | i_pageNum = 1; | 546 | i_pageNum = 1; |
542 | currentLine = 0; | 547 | currentLine = 0; |
543 | QString s_pattern="*END*THE SMALL PRINT"; | 548 | QString s_pattern="*END*THE SMALL PRINT"; |
544 | QString sPattern2 = "*END THE SMALL PRINT"; | 549 | QString sPattern2 = "*END THE SMALL PRINT"; |
545 | 550 | ||
546 | int pageSize = Lview->PageSize(); | 551 | int pageSize = Lview->PageSize(); |
547 | Lview->clear(); | 552 | Lview->clear(); |
548 | 553 | ||
549 | // int lines = Lview->numLines(); | 554 | // int lines = Lview->numLines(); |
550 | int pos = 0;//, i = 0; | 555 | int pos = 0;//, i = 0; |
551 | int i_topRow = Lview->topRow(); | 556 | int i_topRow = Lview->topRow(); |
552 | 557 | ||
553 | QString LeftText;// = Lview->text(); | 558 | QString LeftText;// = Lview->text(); |
554 | 559 | ||
555 | int linesPerPage = Lview->lastRow() - Lview->topRow(); | 560 | int linesPerPage = Lview->lastRow() - Lview->topRow(); |
556 | // int pages = (( linesPerPage / Lview->editSize() ) ) +1; | 561 | // int pages = (( linesPerPage / Lview->editSize() ) ) +1; |
557 | // int pageN = 0; | 562 | // int pageN = 0; |
558 | i_pageNum = 1; | 563 | i_pageNum = 1; |
559 | int lastPage=1; | 564 | int lastPage=1; |
560 | int lineNo=0; | 565 | int lineNo=0; |
561 | QString s; | 566 | QString s; |
562 | f.at( 0); | 567 | f.at( 0); |
563 | 568 | ||
564 | while ( !f.atEnd() ) { | 569 | while ( !f.atEnd() ) { |
565 | f.readLine(s, 256); | 570 | f.readLine(s, 256); |
566 | lineNo++; | 571 | lineNo++; |
567 | LeftText = s; | 572 | LeftText = s; |
568 | currentFilePos = f.at(); | 573 | currentFilePos = f.at(); |
569 | 574 | ||
570 | i_pageNum = lineNo/pageSize; | 575 | i_pageNum = lineNo/pageSize; |
571 | if(lastPage < i_pageNum) { | 576 | if(lastPage < i_pageNum) { |
572 | pageStopArray.resize(i_pageNum + 1); | 577 | pageStopArray.resize(i_pageNum + 1); |
573 | pageStopArray[i_pageNum ] = currentFilePos; | 578 | pageStopArray[i_pageNum ] = currentFilePos; |
574 | // qDebug("new page number %d, found at %d", i_pageNum, currentFilePos); | 579 | // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; |
575 | } | 580 | } |
576 | // lastPage = i_pageNum; | 581 | // lastPage = i_pageNum; |
577 | if( LeftText.find( s_pattern, 0 , TRUE) != -1 || LeftText.find( sPattern2, 0 , TRUE) != -1 ) { | 582 | if( LeftText.find( s_pattern, 0 , TRUE) != -1 || LeftText.find( sPattern2, 0 , TRUE) != -1 ) { |
578 | qDebug("<<<<<< FOUND IT!! new page number %d, found at %d", i_pageNum, currentFilePos); | 583 | odebug << "<<<<<< FOUND IT!! new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; |
579 | break; | 584 | break; |
580 | } | 585 | } |
581 | } | 586 | } |
582 | if(f.atEnd()) //in case we didnt find anything, we need to show something | 587 | if(f.atEnd()) //in case we didnt find anything, we need to show something |
583 | f.at(0); | 588 | f.at(0); |
584 | Lview->clear(); | 589 | Lview->clear(); |
585 | for(int fd=0; fd < pageSize - 1;fd++) { | 590 | for(int fd=0; fd < pageSize - 1;fd++) { |
586 | f.readLine(s, 256); | 591 | f.readLine(s, 256); |
587 | if(useWrap) | 592 | if(useWrap) |
588 | s.replace(QRegExp("\n"),""); | 593 | s.replace(QRegExp("\n"),""); |
589 | Lview->insertLine( s, -1); | 594 | Lview->insertLine( s, -1); |
590 | currentLine++; | 595 | currentLine++; |
591 | } | 596 | } |
592 | 597 | ||
593 | i_pageNum = lineNo/pageSize; | 598 | i_pageNum = lineNo/pageSize; |
594 | pageStopArray.resize(i_pageNum + 1); | 599 | pageStopArray.resize(i_pageNum + 1); |
595 | // int length = Lview->length(); | 600 | // int length = Lview->length(); |
596 | 601 | ||
597 | qApp->processEvents(); | 602 | qApp->processEvents(); |
598 | 603 | ||
599 | if( pos > i_topRow ) { | 604 | if( pos > i_topRow ) { |
600 | Lview->setCursorPosition( pos+linesPerPage+2/* - i_topRow+3 */,0, FALSE); | 605 | Lview->setCursorPosition( pos+linesPerPage+2/* - i_topRow+3 */,0, FALSE); |
601 | } else { | 606 | } else { |
602 | Lview->setCursorPosition( pos+2 , 0, FALSE ); | 607 | Lview->setCursorPosition( pos+2 , 0, FALSE ); |
603 | } | 608 | } |
604 | 609 | ||
605 | Lview->deselect(); | 610 | Lview->deselect(); |
606 | // AdjustStatus(); | 611 | // AdjustStatus(); |
607 | Lview->setFocus(); | 612 | Lview->setFocus(); |
608 | } | 613 | } |
@@ -610,38 +615,38 @@ void Gutenbrowser::BeginBtn() { | |||
610 | /* | 615 | /* |
611 | sets the current page and place as a bookmark*/ | 616 | sets the current page and place as a bookmark*/ |
612 | void Gutenbrowser::setBookmark() { | 617 | void Gutenbrowser::setBookmark() { |
613 | int eexit=QMessageBox::information(this, "Note", | 618 | int eexit=QMessageBox::information(this, "Note", |
614 | "Do you really want to \nset this bookmark?." | 619 | "Do you really want to \nset this bookmark?." |
615 | ,QMessageBox::Yes, QMessageBox::No); | 620 | ,QMessageBox::Yes, QMessageBox::No); |
616 | if (eexit== 3) { | 621 | if (eexit== 3) { |
617 | 622 | ||
618 | currentFilePos = f.at(); | 623 | currentFilePos = f.at(); |
619 | 624 | ||
620 | Config cfg("Gutenbrowser"); | 625 | Config cfg("Gutenbrowser"); |
621 | cfg.setGroup("General"); | 626 | cfg.setGroup("General"); |
622 | file_name=cfg.readEntry("Current",""); | 627 | file_name=cfg.readEntry("Current",""); |
623 | qApp->processEvents(); | 628 | qApp->processEvents(); |
624 | qDebug("Settingbook mark "+file_name); | 629 | odebug << "Settingbook mark "+file_name << oendl; |
625 | 630 | ||
626 | cfg.setGroup("Titles"); | 631 | cfg.setGroup("Titles"); |
627 | title=cfg.readEntry(file_name,""); | 632 | title=cfg.readEntry(file_name,""); |
628 | qDebug("title is "+ title); | 633 | odebug << "title is "+ title << oendl; |
629 | 634 | ||
630 | cfg.setGroup( "Bookmarks" ); | 635 | cfg.setGroup( "Bookmarks" ); |
631 | 636 | ||
632 | cfg.writeEntry("File Name",file_name); | 637 | cfg.writeEntry("File Name",file_name); |
633 | cfg.writeEntry("Page Number",QString::number(i_pageNum) ); | 638 | cfg.writeEntry("Page Number",QString::number(i_pageNum) ); |
634 | cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1])); | 639 | cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1])); |
635 | cfg.writeEntry("Title", title); | 640 | cfg.writeEntry("Title", title); |
636 | 641 | ||
637 | int row = Lview->topRow();// Lview->Top(); | 642 | int row = Lview->topRow();// Lview->Top(); |
638 | cfg.writeEntry("LineNumber",QString::number(row) ); | 643 | cfg.writeEntry("LineNumber",QString::number(row) ); |
639 | 644 | ||
640 | cfg.setGroup(title); | 645 | cfg.setGroup(title); |
641 | cfg.writeEntry("File Name",file_name); | 646 | cfg.writeEntry("File Name",file_name); |
642 | cfg.writeEntry( "LineNumber", QString::number( row)); | 647 | cfg.writeEntry( "LineNumber", QString::number( row)); |
643 | cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1])); | 648 | cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1])); |
644 | cfg.writeEntry( "Page Number", QString::number( i_pageNum) ); | 649 | cfg.writeEntry( "Page Number", QString::number( i_pageNum) ); |
645 | bookmarksMenu->insertItem( title); | 650 | bookmarksMenu->insertItem( title); |
646 | } | 651 | } |
647 | } //end setBookmark | 652 | } //end setBookmark |
@@ -652,83 +657,83 @@ void Gutenbrowser::Bookmark( int itemId) { | |||
652 | 657 | ||
653 | // qApp->processEvents(); | 658 | // qApp->processEvents(); |
654 | Config config("Gutenbrowser"); | 659 | Config config("Gutenbrowser"); |
655 | config.setGroup( "Bookmarks" ); | 660 | config.setGroup( "Bookmarks" ); |
656 | 661 | ||
657 | // qDebug("<<<<<< %d, %d", Lview->PageSize(), Lview->lastRow() - Lview->topRow() ); | 662 | // odebug << "<<<<<< " << Lview->PageSize() << ", " << Lview->lastRow() - Lview->topRow() << "" << oendl; |
658 | 663 | ||
659 | QString itemString; | 664 | QString itemString; |
660 | 665 | ||
661 | qDebug("menu item %d", itemId); | 666 | odebug << "menu item " << itemId << "" << oendl; |
662 | QString tempTitle; | 667 | QString tempTitle; |
663 | QString s_Bmrkrow; | 668 | QString s_Bmrkrow; |
664 | QString s_pageNum; | 669 | QString s_pageNum; |
665 | int Bmrkrow=0; | 670 | int Bmrkrow=0; |
666 | int bookmarkPosition = 0; | 671 | int bookmarkPosition = 0; |
667 | 672 | ||
668 | // qApp->processEvents(); | 673 | // qApp->processEvents(); |
669 | config.setGroup( "Bookmarks" ); | 674 | config.setGroup( "Bookmarks" ); |
670 | title = config.readEntry("Title", ""); | 675 | title = config.readEntry("Title", ""); |
671 | file_name = config.readEntry("File Name", ""); | 676 | file_name = config.readEntry("File Name", ""); |
672 | i_pageNum = config.readNumEntry("Page Number", 0); | 677 | i_pageNum = config.readNumEntry("Page Number", 0); |
673 | bookmarkPosition = config.readNumEntry( "PagePosition",0); | 678 | bookmarkPosition = config.readNumEntry( "PagePosition",0); |
674 | Bmrkrow = config.readNumEntry("LineNumber",0); | 679 | Bmrkrow = config.readNumEntry("LineNumber",0); |
675 | if( !file_name.contains("/")) { | 680 | if( !file_name.contains("/")) { |
676 | file_name = local_library + file_name; | 681 | file_name = local_library + file_name; |
677 | } | 682 | } |
678 | 683 | ||
679 | // getTitle(file_name); | 684 | // getTitle(file_name); |
680 | // qApp->processEvents(); | 685 | // qApp->processEvents(); |
681 | // Lview->setFocus(); | 686 | // Lview->setFocus(); |
682 | this->setFocus(); | 687 | this->setFocus(); |
683 | 688 | ||
684 | Lview->clear(); | 689 | Lview->clear(); |
685 | 690 | ||
686 | load(file_name); | 691 | load(file_name); |
687 | 692 | ||
688 | int pageSize= Lview->PageSize(); | 693 | int pageSize= Lview->PageSize(); |
689 | f.at(0); | 694 | f.at(0); |
690 | // Lview->clear(); | 695 | // Lview->clear(); |
691 | QString s; | 696 | QString s; |
692 | int lineNo=0; | 697 | int lineNo=0; |
693 | int lastPage=1; | 698 | int lastPage=1; |
694 | while ( !f.atEnd() ) { | 699 | while ( !f.atEnd() ) { |
695 | f.readLine(s, 256); | 700 | f.readLine(s, 256); |
696 | lineNo++; | 701 | lineNo++; |
697 | currentFilePos = f.at(); | 702 | currentFilePos = f.at(); |
698 | 703 | ||
699 | i_pageNum = lineNo/pageSize; | 704 | i_pageNum = lineNo/pageSize; |
700 | if(lastPage < i_pageNum) { | 705 | if(lastPage < i_pageNum) { |
701 | pageStopArray.resize(i_pageNum + 1); | 706 | pageStopArray.resize(i_pageNum + 1); |
702 | pageStopArray[i_pageNum ] = currentFilePos; | 707 | pageStopArray[i_pageNum ] = currentFilePos; |
703 | // qDebug("new page number %d, found at %d", i_pageNum, currentFilePos); | 708 | // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; |
704 | } | 709 | } |
705 | if(currentFilePos == bookmarkPosition) | 710 | if(currentFilePos == bookmarkPosition) |
706 | break; | 711 | break; |
707 | } | 712 | } |
708 | if(f.atEnd()) | 713 | if(f.atEnd()) |
709 | f.at(0); | 714 | f.at(0); |
710 | else | 715 | else |
711 | f.at( bookmarkPosition); | 716 | f.at( bookmarkPosition); |
712 | 717 | ||
713 | for(int fd=0; fd < pageSize - 1;fd++) { | 718 | for(int fd=0; fd < pageSize - 1;fd++) { |
714 | f.readLine(s, 256); | 719 | f.readLine(s, 256); |
715 | lineNo++; | 720 | lineNo++; |
716 | if(useWrap) | 721 | if(useWrap) |
717 | s.replace(QRegExp("\n"),""); | 722 | s.replace(QRegExp("\n"),""); |
718 | Lview->insertLine( s, -1); | 723 | Lview->insertLine( s, -1); |
719 | currentLine++; | 724 | currentLine++; |
720 | } | 725 | } |
721 | 726 | ||
722 | i_pageNum = lineNo/pageSize; | 727 | i_pageNum = lineNo/pageSize; |
723 | pageStopArray.resize(i_pageNum + 1); | 728 | pageStopArray.resize(i_pageNum + 1); |
724 | 729 | ||
725 | if(showMainList) { | 730 | if(showMainList) { |
726 | showMainList=FALSE; | 731 | showMainList=FALSE; |
727 | mainList->hide(); | 732 | mainList->hide(); |
728 | Lview->show(); | 733 | Lview->show(); |
729 | // qApp->processEvents(); | 734 | // qApp->processEvents(); |
730 | } | 735 | } |
731 | 736 | ||
732 | qDebug("bookmark loaded"); | 737 | odebug << "bookmark loaded" << oendl; |
733 | setCaption(title); | 738 | setCaption(title); |
734 | } | 739 | } |
@@ -738,82 +743,82 @@ bool Gutenbrowser::load( const char *fileName) { | |||
738 | 743 | ||
739 | // QCopEnvelope ( "QPE/System", "busy()" ); | 744 | // QCopEnvelope ( "QPE/System", "busy()" ); |
740 | // qDebug("Title is already set as "+title); | 745 | // odebug << "Title is already set as "+title << oendl; |
741 | qDebug("sizeHint %d pageSize %d", sizeHint().height(),Lview->PageSize() ); | 746 | odebug << "sizeHint " << sizeHint().height() << " pageSize " << Lview->PageSize() << "" << oendl; |
742 | if( Lview->PageSize() < 4) { | 747 | if( Lview->PageSize() < 4) { |
743 | 748 | ||
744 | Lview->setMaximumHeight( sizeHint().height() ); | 749 | Lview->setMaximumHeight( sizeHint().height() ); |
745 | Lview->setMinimumHeight( sizeHint().height() ); | 750 | Lview->setMinimumHeight( sizeHint().height() ); |
746 | pointSize = Lview->fontInfo().pointSize(); | 751 | pointSize = Lview->fontInfo().pointSize(); |
747 | qDebug("sizeHint %d point size %d", sizeHint().height(), pointSize); | 752 | odebug << "sizeHint " << sizeHint().height() << " point size " << pointSize << "" << oendl; |
748 | if(pointSize < 10) | 753 | if(pointSize < 10) |
749 | Lview->setFixedVisibleLines(19); | 754 | Lview->setFixedVisibleLines(19); |
750 | else | 755 | else |
751 | Lview->setFixedVisibleLines( ( (sizeHint().height() / pointSize ) * 2) -2); | 756 | Lview->setFixedVisibleLines( ( (sizeHint().height() / pointSize ) * 2) -2); |
752 | } | 757 | } |
753 | 758 | ||
754 | Config cfg("Gutenbrowser"); | 759 | Config cfg("Gutenbrowser"); |
755 | cfg.setGroup("General"); | 760 | cfg.setGroup("General"); |
756 | cfg.writeEntry("Current",fileName); | 761 | cfg.writeEntry("Current",fileName); |
757 | currentLine=0; | 762 | currentLine=0; |
758 | 763 | ||
759 | file_name=fileName; | 764 | file_name=fileName; |
760 | QString o_file = fileName; | 765 | QString o_file = fileName; |
761 | 766 | ||
762 | // if (i_pageNum < 1) { | 767 | // if (i_pageNum < 1) { |
763 | i_pageNum = 1; | 768 | i_pageNum = 1; |
764 | // } | 769 | // } |
765 | qDebug("ready to open "+o_file); | 770 | odebug << "ready to open "+o_file << oendl; |
766 | 771 | ||
767 | if(f.isOpen()) f.close(); | 772 | if(f.isOpen()) f.close(); |
768 | f.setName( o_file); | 773 | f.setName( o_file); |
769 | 774 | ||
770 | if ( !f.open( IO_ReadOnly)) { | 775 | if ( !f.open( IO_ReadOnly)) { |
771 | QMessageBox::message( (tr("Note")), (tr("File not opened sucessfully.\n" +o_file)) ); | 776 | QMessageBox::message( (tr("Note")), (tr("File not opened sucessfully.\n" +o_file)) ); |
772 | return false; | 777 | return false; |
773 | } | 778 | } |
774 | currentFilePos = 0; | 779 | currentFilePos = 0; |
775 | pageStopArray.resize(3); | 780 | pageStopArray.resize(3); |
776 | pageStopArray[0] = currentFilePos; | 781 | pageStopArray[0] = currentFilePos; |
777 | 782 | ||
778 | fileHandle = f.handle(); | 783 | fileHandle = f.handle(); |
779 | QString insertString; | 784 | QString insertString; |
780 | QTextStream t(&f); | 785 | QTextStream t(&f); |
781 | QString s; | 786 | QString s; |
782 | for(int fd=0; fd < Lview->PageSize() ;fd++) { | 787 | for(int fd=0; fd < Lview->PageSize() ;fd++) { |
783 | s=t.readLine(); | 788 | s=t.readLine(); |
784 | // insertString+=s; | 789 | // insertString+=s; |
785 | if(useWrap) | 790 | if(useWrap) |
786 | s.replace(QRegExp("\n"),""); | 791 | s.replace(QRegExp("\n"),""); |
787 | // s.replace(QRegExp("\r"),""); | 792 | // s.replace(QRegExp("\r"),""); |
788 | Lview->insertLine( s,-1); | 793 | Lview->insertLine( s,-1); |
789 | currentLine++; | 794 | currentLine++; |
790 | } | 795 | } |
791 | 796 | ||
792 | // int length = Lview->length(); | 797 | // int length = Lview->length(); |
793 | currentFilePos = f.at(); | 798 | currentFilePos = f.at(); |
794 | 799 | ||
795 | pageStopArray[1] = currentFilePos; | 800 | pageStopArray[1] = currentFilePos; |
796 | 801 | ||
797 | qDebug("<<<<<<<<<<<%d current page is number %d, length %d, current %d, pageSize %d", | 802 | qDebug("<<<<<<<<<<<%d current page is number %d, length %d, current %d, pageSize %d", |
798 | currentFilePos, i_pageNum, Lview->length(), pageStopArray[i_pageNum], Lview->PageSize() ); | 803 | currentFilePos, i_pageNum, Lview->length(), pageStopArray[i_pageNum], Lview->PageSize() ); |
799 | 804 | ||
800 | Lview->setMaxLines(Lview->PageSize()*2); | 805 | Lview->setMaxLines(Lview->PageSize()*2); |
801 | qDebug("Gulped %d", currentLine); | 806 | odebug << "Gulped " << currentLine << "" << oendl; |
802 | setCaption(title); | 807 | setCaption(title); |
803 | Lview->setAutoUpdate( TRUE); | 808 | Lview->setAutoUpdate( TRUE); |
804 | 809 | ||
805 | Lview->setCursorPosition(0,0,FALSE); | 810 | Lview->setCursorPosition(0,0,FALSE); |
806 | 811 | ||
807 | // pages = (int)(( Lview->numLines() / Lview->editSize() ) / 2 ) +1; | 812 | // pages = (int)(( Lview->numLines() / Lview->editSize() ) / 2 ) +1; |
808 | //qDebug("number of pages %d", pages); | 813 | //odebug << "number of pages " << pages << "" << oendl; |
809 | 814 | ||
810 | loadCheck = true; | 815 | loadCheck = true; |
811 | enableButtons(true); | 816 | enableButtons(true); |
812 | if( donateMenu->count() == 3) { | 817 | if( donateMenu->count() == 3) { |
813 | donateMenu->insertItem("Current Title", this, SLOT( InfoBarClick() )); | 818 | donateMenu->insertItem("Current Title", this, SLOT( InfoBarClick() )); |
814 | } | 819 | } |
815 | Lview->setFocus(); | 820 | Lview->setFocus(); |
816 | 821 | ||
817 | // QCopEnvelope("QPE/System", "notBusy()" ); | 822 | // QCopEnvelope("QPE/System", "notBusy()" ); |
818 | return true; | 823 | return true; |
819 | } // end load | 824 | } // end load |
@@ -822,17 +827,17 @@ void Gutenbrowser::Search() { | |||
822 | 827 | ||
823 | // if( searchDlg->isHidden()) | 828 | // if( searchDlg->isHidden()) |
824 | { | 829 | { |
825 | qDebug("Starting search dialog"); | 830 | odebug << "Starting search dialog" << oendl; |
826 | searchDlg = new SearchDialog( this, "Etext Search", true); | 831 | searchDlg = new SearchDialog( this, "Etext Search", true); |
827 | searchDlg->setCaption( tr( "Etext Search" )); | 832 | searchDlg->setCaption( tr( "Etext Search" )); |
828 | // searchDlg->setLabel( "- searches etext"); | 833 | // searchDlg->setLabel( "- searches etext"); |
829 | connect( searchDlg,SIGNAL( search_signal()),this,SLOT( search_slot())); | 834 | connect( searchDlg,SIGNAL( search_signal()),this,SLOT( search_slot())); |
830 | connect( searchDlg,SIGNAL( search_done_signal()),this,SLOT( searchdone_slot())); | 835 | connect( searchDlg,SIGNAL( search_done_signal()),this,SLOT( searchdone_slot())); |
831 | 836 | ||
832 | QString resultString; | 837 | QString resultString; |
833 | QString string = searchDlg->searchString; | 838 | QString string = searchDlg->searchString; |
834 | Lview->deselect(); | 839 | Lview->deselect(); |
835 | searchDlg->show(); | 840 | searchDlg->show(); |
836 | searchDlg->result(); | 841 | searchDlg->result(); |
837 | } | 842 | } |
838 | } | 843 | } |
@@ -842,3 +847,3 @@ void Gutenbrowser::search_slot( ) { | |||
842 | if (!searchDlg /*&& !loadCheck */) | 847 | if (!searchDlg /*&& !loadCheck */) |
843 | return; | 848 | return; |
844 | 849 | ||
@@ -847,5 +852,5 @@ void Gutenbrowser::search_slot( ) { | |||
847 | 852 | ||
848 | // searchDlg->get_direction();// is true if searching backward | 853 | // searchDlg->get_direction();// is true if searching backward |
849 | if ( last_search != 0 && searchDlg->get_direction() ){ | 854 | if ( last_search != 0 && searchDlg->get_direction() ){ |
850 | col = col - pattern.length() - 1 ; | 855 | col = col - pattern.length() - 1 ; |
851 | } | 856 | } |
@@ -854,27 +859,27 @@ void Gutenbrowser::search_slot( ) { | |||
854 | if(result == 0){ | 859 | if(result == 0){ |
855 | if(!searchDlg->get_direction()){ // forward search | 860 | if(!searchDlg->get_direction()){ // forward search |
856 | int query = QMessageBox::information( searchDlg, "Find", | 861 | int query = QMessageBox::information( searchDlg, "Find", |
857 | "End of document reached.\nContinue from the beginning?", | 862 | "End of document reached.\nContinue from the beginning?", |
858 | "Yes", "No", "", 0,1); | 863 | "Yes", "No", "", 0,1); |
859 | if (query == 0){ | 864 | if (query == 0){ |
860 | line = 0; | 865 | line = 0; |
861 | col = 0; | 866 | col = 0; |
862 | goto again; | 867 | goto again; |
863 | } | 868 | } |
864 | } else { //backward search | 869 | } else { //backward search |
865 | int query = QMessageBox::information( searchDlg, "Find", | 870 | int query = QMessageBox::information( searchDlg, "Find", |
866 | "End of document reached.\nContinue from the beginning?", | 871 | "End of document reached.\nContinue from the beginning?", |
867 | "Yes", "No", "", 0,1); | 872 | "Yes", "No", "", 0,1); |
868 | if (query == 0){ | 873 | if (query == 0){ |
869 | QString string = Lview->textLine( Lview->numLines() - 1 ); | 874 | QString string = Lview->textLine( Lview->numLines() - 1 ); |
870 | line = Lview->numLines() - 1; | 875 | line = Lview->numLines() - 1; |
871 | lineCheck = line; | 876 | lineCheck = line; |
872 | col = string.length(); | 877 | col = string.length(); |
873 | last_search = -1; //BACKWARD; | 878 | last_search = -1; //BACKWARD; |
874 | goto again; | 879 | goto again; |
875 | } | 880 | } |
876 | } | 881 | } |
877 | } else { | 882 | } else { |
878 | 883 | ||
879 | //// emit CursorPositionChanged(); textLine | 884 | //// emit CursorPositionChanged(); textLine |
880 | } | 885 | } |
@@ -883,73 +888,73 @@ void Gutenbrowser::search_slot( ) { | |||
883 | int Gutenbrowser::doSearch( const QString &s_pattern , bool case_sensitive, bool forward, int line, int col ) { | 888 | int Gutenbrowser::doSearch( const QString &s_pattern , bool case_sensitive, bool forward, int line, int col ) { |
884 | int i, length; | 889 | int i, length; |
885 | int pos = -1; | 890 | int pos = -1; |
886 | if(forward) { | 891 | if(forward) { |
887 | QString string; | 892 | QString string; |
888 | for(i = line; i < Lview->numLines(); i++) { | 893 | for(i = line; i < Lview->numLines(); i++) { |
889 | 894 | ||
890 | string = Lview->textLine(i); | 895 | string = Lview->textLine(i); |
891 | pos = string.find(s_pattern, i == line ? col : 0, case_sensitive); | 896 | pos = string.find(s_pattern, i == line ? col : 0, case_sensitive); |
892 | if( pos != -1) { | 897 | if( pos != -1) { |
893 | int top = Lview->Top(); | 898 | int top = Lview->Top(); |
894 | length = s_pattern.length(); | 899 | length = s_pattern.length(); |
895 | if( i > Lview->lastRow() ) { | 900 | if( i > Lview->lastRow() ) { |
896 | Lview->setCursorPosition(i,pos,FALSE); | 901 | Lview->setCursorPosition(i,pos,FALSE); |
897 | for(int l = 0 ; l < length; l++) { | 902 | for(int l = 0 ; l < length; l++) { |
898 | Lview->cursorRight(TRUE); | 903 | Lview->cursorRight(TRUE); |
899 | } | 904 | } |
900 | Lview->setCursorPosition( i , pos + length, TRUE ); | 905 | Lview->setCursorPosition( i , pos + length, TRUE ); |
901 | int newTop = Lview->Top(); | 906 | int newTop = Lview->Top(); |
902 | if(Lview->lastRow() > i) | 907 | if(Lview->lastRow() > i) |
903 | Lview->ScrollUp( newTop - top); | 908 | Lview->ScrollUp( newTop - top); |
904 | // AdjustStatus(); | 909 | // AdjustStatus(); |
905 | } else { | 910 | } else { |
906 | Lview->setCursorPosition(i,pos,FALSE); | 911 | Lview->setCursorPosition(i,pos,FALSE); |
907 | for(int l = 0 ; l < length; l++) { | 912 | for(int l = 0 ; l < length; l++) { |
908 | Lview->cursorRight(TRUE); | 913 | Lview->cursorRight(TRUE); |
909 | } | 914 | } |
910 | Lview->setCursorPosition( i , pos + length, TRUE ); | 915 | Lview->setCursorPosition( i , pos + length, TRUE ); |
911 | // AdjustStatus(); | 916 | // AdjustStatus(); |
912 | } | 917 | } |
913 | pattern = s_pattern; | 918 | pattern = s_pattern; |
914 | last_search = 1; //FORWARD; | 919 | last_search = 1; //FORWARD; |
915 | return 1; | 920 | return 1; |
916 | } | 921 | } |
917 | } | 922 | } |
918 | } else { //////////////// searching backwards | 923 | } else { //////////////// searching backwards |
919 | QString string; | 924 | QString string; |
920 | for( i = line; i >= 0; i--) { | 925 | for( i = line; i >= 0; i--) { |
921 | string = Lview->textLine(i); | 926 | string = Lview->textLine(i); |
922 | int line_length = string.length(); | 927 | int line_length = string.length(); |
923 | pos = string.findRev(s_pattern, line == i ? col : line_length , case_sensitive); | 928 | pos = string.findRev(s_pattern, line == i ? col : line_length , case_sensitive); |
924 | if (pos != -1) { | 929 | if (pos != -1) { |
925 | // int top = Lview->Top(); | 930 | // int top = Lview->Top(); |
926 | length = s_pattern.length(); | 931 | length = s_pattern.length(); |
927 | if( i < Lview->Top() ) { | 932 | if( i < Lview->Top() ) { |
928 | Lview->ScrollDown( Lview->PageSize() ); | 933 | Lview->ScrollDown( Lview->PageSize() ); |
929 | Lview->MultiLine_Ex::pageUp( FALSE ); | 934 | Lview->MultiLine_Ex::pageUp( FALSE ); |
930 | if( ! (line == i && pos > col ) ) { | 935 | if( ! (line == i && pos > col ) ) { |
931 | Lview->setCursorPosition( i ,pos ,FALSE ); | 936 | Lview->setCursorPosition( i ,pos ,FALSE ); |
932 | for(int l = 0 ; l < length; l++) { | 937 | for(int l = 0 ; l < length; l++) { |
933 | Lview->cursorRight(TRUE); | 938 | Lview->cursorRight(TRUE); |
934 | } | 939 | } |
935 | Lview->setCursorPosition(i ,pos + length ,TRUE ); | 940 | Lview->setCursorPosition(i ,pos + length ,TRUE ); |
936 | // int newTop = Lview->Top(); | 941 | // int newTop = Lview->Top(); |
937 | /* if(useSplitter) Rview->ScrollUp( newTop - top); | 942 | /* if(useSplitter) Rview->ScrollUp( newTop - top); |
938 | */ } | 943 | */ } |
939 | } else { | 944 | } else { |
940 | if( ! (line == i && pos > col ) ) { | 945 | if( ! (line == i && pos > col ) ) { |
941 | Lview->setCursorPosition( i, pos, FALSE ); | 946 | Lview->setCursorPosition( i, pos, FALSE ); |
942 | for( int l = 0 ; l < length; l++) { | 947 | for( int l = 0 ; l < length; l++) { |
943 | Lview->cursorRight( TRUE); | 948 | Lview->cursorRight( TRUE); |
944 | } | 949 | } |
945 | Lview->setCursorPosition( i, pos + length, TRUE ); | 950 | Lview->setCursorPosition( i, pos + length, TRUE ); |
946 | } | 951 | } |
947 | pattern = s_pattern; | 952 | pattern = s_pattern; |
948 | last_search = -1; | 953 | last_search = -1; |
949 | return 1; | 954 | return 1; |
950 | } | 955 | } |
951 | } | 956 | } |
952 | } | 957 | } |
953 | } | 958 | } |
954 | return 0; | 959 | return 0; |
955 | } | 960 | } |
@@ -958,97 +963,97 @@ void Gutenbrowser::LibraryBtn() { | |||
958 | 963 | ||
959 | QString newestLibraryFile ="pgwhole.zip"; | 964 | QString newestLibraryFile ="pgwhole.zip"; |
960 | QString zipFile; | 965 | QString zipFile; |
961 | // qDebug("Local Library is %s ", local_library.latin1()); | 966 | // odebug << "Local Library is " << local_library << " " << oendl; |
962 | zipFile="/usr/bin/unzip"; | 967 | zipFile="/usr/bin/unzip"; |
963 | // qDebug("newestLibraryFile is %s ", newestLibraryFile.latin1()); | 968 | // odebug << "newestLibraryFile is " << newestLibraryFile << " " << oendl; |
964 | if( QFile::exists( local_library+newestLibraryFile)) { | 969 | if( QFile::exists( local_library+newestLibraryFile)) { |
965 | if( QFile::exists(zipFile) ) { | 970 | if( QFile::exists(zipFile) ) { |
966 | UnZipIt(newestLibraryFile); | 971 | UnZipIt(newestLibraryFile); |
967 | } | 972 | } |
968 | else | 973 | else |
969 | QMessageBox::message( "Note",( tr("Please install unzip")) ); | 974 | QMessageBox::message( "Note",( tr("Please install unzip")) ); |
970 | } | 975 | } |
971 | // LibraryDlg = new LibraryDialog( this, "Library Index"); | 976 | // LibraryDlg = new LibraryDialog( this, "Library Index"); |
972 | LibraryDlg->setCaption( tr( "Gutenberg Library")); | 977 | LibraryDlg->setCaption( tr( "Gutenberg Library")); |
973 | Config config("Gutenbrowser"); | 978 | Config config("Gutenbrowser"); |
974 | config.setGroup("General"); | 979 | config.setGroup("General"); |
975 | QString tmp=config.readEntry("RunBefore","FALSE"); | 980 | QString tmp=config.readEntry("RunBefore","FALSE"); |
976 | if(tmp=="FALSE") { | 981 | if(tmp=="FALSE") { |
977 | QMessageBox::message( "Note", | 982 | QMessageBox::message( "Note", |
978 | "<P>Your first time running gutenbrowser. You'll need to click the \"load library\" button to load the gutenberg index.</P>"); | 983 | "<P>Your first time running gutenbrowser. You'll need to click the \"load library\" button to load the gutenberg index.</P>"); |
979 | config.writeEntry("RunBefore","TRUE"); | 984 | config.writeEntry("RunBefore","TRUE"); |
980 | } | 985 | } |
981 | if(useSplitter) | 986 | if(useSplitter) |
982 | LibraryDlg->useSmallInterface=FALSE; | 987 | LibraryDlg->useSmallInterface=FALSE; |
983 | 988 | ||
984 | LibraryDlg->showMaximized(); | 989 | LibraryDlg->showMaximized(); |
985 | 990 | ||
986 | if( LibraryDlg->exec() != 0 ) { | 991 | if( LibraryDlg->exec() != 0 ) { |
987 | listItemNumber = LibraryDlg->DlglistItemNumber; | 992 | listItemNumber = LibraryDlg->DlglistItemNumber; |
988 | listItemFile = LibraryDlg->DlglistItemFile; | 993 | listItemFile = LibraryDlg->DlglistItemFile; |
989 | listItemYear = LibraryDlg->DlglistItemYear; | 994 | listItemYear = LibraryDlg->DlglistItemYear; |
990 | listItemTitle = LibraryDlg->DlglistItemTitle; | 995 | listItemTitle = LibraryDlg->DlglistItemTitle; |
991 | file_name = LibraryDlg->File_Name; | 996 | file_name = LibraryDlg->File_Name; |
992 | // qDebug("title is being set as "+title); | 997 | // odebug << "title is being set as "+title << oendl; |
993 | title = listItemTitle; | 998 | title = listItemTitle; |
994 | 999 | ||
995 | // config.setGroup( "Proxy" ); | 1000 | // config.setGroup( "Proxy" ); |
996 | // if( LibraryDlg->checked == 1) { | 1001 | // if( LibraryDlg->checked == 1) { |
997 | // config.writeEntry("IsChecked", "TRUE"); | 1002 | // config.writeEntry("IsChecked", "TRUE"); |
998 | // } else { | 1003 | // } else { |
999 | // config.writeEntry("IsChecked", "FALSE"); | 1004 | // config.writeEntry("IsChecked", "FALSE"); |
1000 | // } | 1005 | // } |
1001 | // config.write(); | 1006 | // config.write(); |
1002 | // config.read(); | 1007 | // config.read(); |
1003 | if ( listItemNumber.isNull()) { | 1008 | if ( listItemNumber.isNull()) { |
1004 | } else { | 1009 | } else { |
1005 | i_pageNum = 1; | 1010 | i_pageNum = 1; |
1006 | if( file_name !="Error" && file_name.length() >2 && !file_name.isEmpty() ) { | 1011 | if( file_name !="Error" && file_name.length() >2 && !file_name.isEmpty() ) { |
1007 | //replace .zip with txt for opening it. | 1012 | //replace .zip with txt for opening it. |
1008 | // printf("\nFile name is now\n"); | 1013 | // printf("\nFile name is now\n"); |
1009 | // printf(file_name); | 1014 | // printf(file_name); |
1010 | // printf("\n"); | 1015 | // printf("\n"); |
1011 | // | 1016 | // |
1012 | if( file_name.find(".zip")) | 1017 | if( file_name.find(".zip")) |
1013 | { | 1018 | { |
1014 | qDebug("Found zip file\n"); | 1019 | odebug << "Found zip file\n" << oendl; |
1015 | // QStringList args; | 1020 | // QStringList args; |
1016 | // args="unzip"; | 1021 | // args="unzip"; |
1017 | // args+="-o"; | 1022 | // args+="-o"; |
1018 | // args+=local_library+file_name; | 1023 | // args+=local_library+file_name; |
1019 | // args+="-d"; | 1024 | // args+="-d"; |
1020 | // args+=local_library; | 1025 | // args+=local_library; |
1021 | QString cmd = "/usr/bin/unzip -o " + local_library+file_name + " -d " + local_library; | 1026 | QString cmd = "/usr/bin/unzip -o " + local_library+file_name + " -d " + local_library; |
1022 | qDebug("Issuing the command "+ cmd); | 1027 | odebug << "Issuing the command "+ cmd << oendl; |
1023 | // unzipProc=new QProcess( this, "unzipProc" ); /// fark that idea! | 1028 | // unzipProc=new QProcess( this, "unzipProc" ); /// fark that idea! |
1024 | // unzipProc->start(); | 1029 | // unzipProc->start(); |
1025 | system(cmd); | 1030 | system(cmd); |
1026 | remove( file_name); | 1031 | remove( file_name); |
1027 | 1032 | ||
1028 | } | 1033 | } |
1029 | // // | 1034 | // // |
1030 | // file_name = file_name.left(4)+ ".txt"; | 1035 | // file_name = file_name.left(4)+ ".txt"; |
1031 | if( LibraryDlg) | 1036 | if( LibraryDlg) |
1032 | delete LibraryDlg; | 1037 | delete LibraryDlg; |
1033 | setTitle(); | 1038 | setTitle(); |
1034 | // QCopEnvelope ( "QPE/System", "busy()" ); | 1039 | // QCopEnvelope ( "QPE/System", "busy()" ); |
1035 | load( file_name); | 1040 | load( file_name); |
1036 | } else { | 1041 | } else { |
1037 | printf("Not opening the file.\n"); | 1042 | printf("Not opening the file.\n"); |
1038 | } | 1043 | } |
1039 | } | 1044 | } |
1040 | } | 1045 | } |
1041 | if(showMainList) { | 1046 | if(showMainList) { |
1042 | if(!Lview->isHidden()) | 1047 | if(!Lview->isHidden()) |
1043 | Lview->hide(); | 1048 | Lview->hide(); |
1044 | qApp->processEvents(); | 1049 | qApp->processEvents(); |
1045 | showMainList=TRUE; | 1050 | showMainList=TRUE; |
1046 | if(mainList->isHidden()) | 1051 | if(mainList->isHidden()) |
1047 | mainList->show(); | 1052 | mainList->show(); |
1048 | fillWithTitles(); | 1053 | fillWithTitles(); |
1049 | qApp->processEvents(); | 1054 | qApp->processEvents(); |
1050 | } else | 1055 | } else |
1051 | setCentralWidget( Lview); | 1056 | setCentralWidget( Lview); |
1052 | // QPEApplication::grabKeyboard(); | 1057 | // QPEApplication::grabKeyboard(); |
1053 | // fixKeys(); | 1058 | // fixKeys(); |
1054 | } | 1059 | } |
@@ -1056,61 +1061,61 @@ void Gutenbrowser::LibraryBtn() { | |||
1056 | void Gutenbrowser::OpenBtn() { | 1061 | void Gutenbrowser::OpenBtn() { |
1057 | QString s_temp; | 1062 | QString s_temp; |
1058 | s_temp = status; | 1063 | s_temp = status; |
1059 | OpenEtext* OpenDlg; | 1064 | OpenEtext* OpenDlg; |
1060 | OpenDlg = new OpenEtext(this,"OpenDlg"); | 1065 | OpenDlg = new OpenEtext(this,"OpenDlg"); |
1061 | OpenDlg->showMaximized(); | 1066 | OpenDlg->showMaximized(); |
1062 | 1067 | ||
1063 | if( OpenDlg->exec() != 0) { | 1068 | if( OpenDlg->exec() != 0) { |
1064 | title = OpenDlg->openFileTitle; | 1069 | title = OpenDlg->openFileTitle; |
1065 | qDebug("title open as "+title); | 1070 | odebug << "title open as "+title << oendl; |
1066 | file_name = OpenDlg->file; | 1071 | file_name = OpenDlg->file; |
1067 | i_pageNum = 1; | 1072 | i_pageNum = 1; |
1068 | 1073 | ||
1069 | if( !file_name.isEmpty() || file_name.length() > 2 ) { | 1074 | if( !file_name.isEmpty() || file_name.length() > 2 ) { |
1070 | if(showMainList) { | 1075 | if(showMainList) { |
1071 | showMainList=FALSE; | 1076 | showMainList=FALSE; |
1072 | qDebug("ShowMainList is now false"); | 1077 | odebug << "ShowMainList is now false" << oendl; |
1073 | mainList->hide(); | 1078 | mainList->hide(); |
1074 | Lview->show(); | 1079 | Lview->show(); |
1075 | qApp->processEvents(); | 1080 | qApp->processEvents(); |
1076 | } | 1081 | } |
1077 | Lview->clear(); | 1082 | Lview->clear(); |
1078 | // QCopEnvelope ( "QPE/System", "busy()" ); | 1083 | // QCopEnvelope ( "QPE/System", "busy()" ); |
1079 | load(file_name); | 1084 | load(file_name); |
1080 | } else { | 1085 | } else { |
1081 | qDebug("file_name is empty!"); | 1086 | odebug << "file_name is empty!" << oendl; |
1082 | if(showMainList) { | 1087 | if(showMainList) { |
1083 | if(!Lview->isHidden()) | 1088 | if(!Lview->isHidden()) |
1084 | Lview->hide(); | 1089 | Lview->hide(); |
1085 | qApp->processEvents(); | 1090 | qApp->processEvents(); |
1086 | if(mainList->isHidden()) | 1091 | if(mainList->isHidden()) |
1087 | mainList->show(); | 1092 | mainList->show(); |
1088 | fillWithTitles(); | 1093 | fillWithTitles(); |
1089 | qApp->processEvents(); | 1094 | qApp->processEvents(); |
1090 | } | 1095 | } |
1091 | 1096 | ||
1092 | } | 1097 | } |
1093 | } | 1098 | } |
1094 | if( OpenDlg) | 1099 | if( OpenDlg) |
1095 | delete OpenDlg; | 1100 | delete OpenDlg; |
1096 | /* | 1101 | /* |
1097 | Config config("Gutenbrowser"); | 1102 | Config config("Gutenbrowser"); |
1098 | config.setGroup( title); | 1103 | config.setGroup( title); |
1099 | file_name = config.readEntry("File Name", ""); | 1104 | file_name = config.readEntry("File Name", ""); |
1100 | i_pageNum = config.readNumEntry("Page Number", -1); | 1105 | i_pageNum = config.readNumEntry("Page Number", -1); |
1101 | int Bmrkrow = config.readNumEntry("LineNumber", -1); | 1106 | int Bmrkrow = config.readNumEntry("LineNumber", -1); |
1102 | if(Bmrkrow > -1) { | 1107 | if(Bmrkrow > -1) { |
1103 | if( Bmrkrow > Lview->topRow() ) { | 1108 | if( Bmrkrow > Lview->topRow() ) { |
1104 | Lview->setCursorPosition( Bmrkrow ,0, FALSE ); | 1109 | Lview->setCursorPosition( Bmrkrow ,0, FALSE ); |
1105 | Lview->ScrollUp( Bmrkrow - Lview->topRow() ); | 1110 | Lview->ScrollUp( Bmrkrow - Lview->topRow() ); |
1106 | // AdjustStatus(); | 1111 | // AdjustStatus(); |
1107 | } | 1112 | } |
1108 | else if( Bmrkrow < Lview->topRow() ) { | 1113 | else if( Bmrkrow < Lview->topRow() ) { |
1109 | Lview->setCursorPosition( Lview->topRow() - Bmrkrow ,0, FALSE ); | 1114 | Lview->setCursorPosition( Lview->topRow() - Bmrkrow ,0, FALSE ); |
1110 | Lview->ScrollDown( Lview->topRow() - Bmrkrow ); | 1115 | Lview->ScrollDown( Lview->topRow() - Bmrkrow ); |
1111 | // AdjustStatus(); | 1116 | // AdjustStatus(); |
1112 | } | 1117 | } |
1113 | } | 1118 | } |
1114 | */ | 1119 | */ |
1115 | // ResizeEdits(); | 1120 | // ResizeEdits(); |
1116 | 1121 | ||
@@ -1120,40 +1125,40 @@ void Gutenbrowser::ChangeFont() { | |||
1120 | #ifndef Q_WS_QWS | 1125 | #ifndef Q_WS_QWS |
1121 | bool ok; | 1126 | bool ok; |
1122 | 1127 | ||
1123 | weight= Lview->fontInfo().weight(); | 1128 | weight= Lview->fontInfo().weight(); |
1124 | italic = Lview->fontInfo().italic(); | 1129 | italic = Lview->fontInfo().italic(); |
1125 | bold=Lview->fontInfo().bold(); | 1130 | bold=Lview->fontInfo().bold(); |
1126 | pointSize= Lview->fontInfo().pointSize(); | 1131 | pointSize= Lview->fontInfo().pointSize(); |
1127 | fontStr=Lview->fontInfo().family(); | 1132 | fontStr=Lview->fontInfo().family(); |
1128 | 1133 | ||
1129 | if(italic == true) | 1134 | if(italic == true) |
1130 | italicStr="TRUE"; | 1135 | italicStr="TRUE"; |
1131 | else | 1136 | else |
1132 | italicStr="FALSE"; | 1137 | italicStr="FALSE"; |
1133 | 1138 | ||
1134 | QFont currentfont( fontStr, pointSize, weight, italic ); | 1139 | QFont currentfont( fontStr, pointSize, weight, italic ); |
1135 | 1140 | ||
1136 | if (ok) { | 1141 | if (ok) { |
1137 | QFontInfo fontInfo(font ); | 1142 | QFontInfo fontInfo(font ); |
1138 | fontStr=fontInfo.family(); | 1143 | fontStr=fontInfo.family(); |
1139 | 1144 | ||
1140 | pointSize= fontInfo.pointSize(); | 1145 | pointSize= fontInfo.pointSize(); |
1141 | 1146 | ||
1142 | font.setFontSize(pointSize); | 1147 | font.setFontSize(pointSize); |
1143 | 1148 | ||
1144 | pointSizeStr.setNum( pointSize); | 1149 | pointSizeStr.setNum( pointSize); |
1145 | 1150 | ||
1146 | weight= fontInfo.weight(); | 1151 | weight= fontInfo.weight(); |
1147 | weightStr.setNum( weight); | 1152 | weightStr.setNum( weight); |
1148 | italic =fontInfo.italic(); | 1153 | italic =fontInfo.italic(); |
1149 | bold=fontInfo.bold(); | 1154 | bold=fontInfo.bold(); |
1150 | 1155 | ||
1151 | if(italic == true) | 1156 | if(italic == true) |
1152 | italicStr="TRUE"; | 1157 | italicStr="TRUE"; |
1153 | else | 1158 | else |
1154 | italicStr="FALSE"; | 1159 | italicStr="FALSE"; |
1155 | if(bold == true) | 1160 | if(bold == true) |
1156 | boldStr="TRUE"; | 1161 | boldStr="TRUE"; |
1157 | else | 1162 | else |
1158 | boldStr="FALSE"; | 1163 | boldStr="FALSE"; |
1159 | 1164 | ||
@@ -1166,3 +1171,3 @@ void Gutenbrowser::ChangeFont() { | |||
1166 | config.writeEntry("Bold", boldStr ); | 1171 | config.writeEntry("Bold", boldStr ); |
1167 | // config.write(); | 1172 | // config.write(); |
1168 | 1173 | ||
@@ -1175,7 +1180,7 @@ void Gutenbrowser::ChangeFont() { | |||
1175 | } | 1180 | } |
1176 | // if(loadCheck) { | 1181 | // if(loadCheck) { |
1177 | // ResizeEdits(); | 1182 | // ResizeEdits(); |
1178 | // } | 1183 | // } |
1179 | update(); | 1184 | update(); |
1180 | } | 1185 | } |
1181 | #endif | 1186 | #endif |
@@ -1185,18 +1190,18 @@ void Gutenbrowser::ChangeFont() { | |||
1185 | /* | 1190 | /* |
1186 | performs dictionary look ups on the web */ | 1191 | performs dictionary look ups on the web */ |
1187 | void Gutenbrowser::LookupBtn() { | 1192 | void Gutenbrowser::LookupBtn() { |
1188 | QString text; | 1193 | QString text; |
1189 | if( Lview->hasSelectedText()) { | 1194 | if( Lview->hasSelectedText()) { |
1190 | Lview->copy(); | 1195 | Lview->copy(); |
1191 | } | 1196 | } |
1192 | QClipboard *cb = QApplication::clipboard(); | 1197 | QClipboard *cb = QApplication::clipboard(); |
1193 | text = cb->text(); | 1198 | text = cb->text(); |
1194 | int eexit=QMessageBox::information(this, | 1199 | int eexit=QMessageBox::information(this, |
1195 | "Note","Do you want to lookup\n\""+text+"\"\non websters web dictionary?", | 1200 | "Note","Do you want to lookup\n\""+text+"\"\non websters web dictionary?", |
1196 | QMessageBox::Yes, QMessageBox::No); | 1201 | QMessageBox::Yes, QMessageBox::No); |
1197 | if (eexit== 3) { | 1202 | if (eexit== 3) { |
1198 | // this link for sale!! | 1203 | // this link for sale!! |
1199 | qApp->processEvents(); | 1204 | qApp->processEvents(); |
1200 | goGetit( "http://www.m-w.com/cgi-bin/dictionary?" + text, true); | 1205 | goGetit( "http://www.m-w.com/cgi-bin/dictionary?" + text, true); |
1201 | } | 1206 | } |
1202 | } | 1207 | } |
@@ -1204,19 +1209,19 @@ void Gutenbrowser::LookupBtn() { | |||
1204 | void Gutenbrowser::ClearEdit() { | 1209 | void Gutenbrowser::ClearEdit() { |
1205 | Lview->setText(""); | 1210 | Lview->setText(""); |
1206 | loadCheck = false; | 1211 | loadCheck = false; |
1207 | status = ( tr("Gutenbrowser")); | 1212 | status = ( tr("Gutenbrowser")); |
1208 | InfoBar->setText( ""); | 1213 | InfoBar->setText( ""); |
1209 | setCaption( tr("Gutenbrowser")); | 1214 | setCaption( tr("Gutenbrowser")); |
1210 | i_pageNum = 0; | 1215 | i_pageNum = 0; |
1211 | enableButtons(false); | 1216 | enableButtons(false); |
1212 | 1217 | ||
1213 | if(!showMainList) { | 1218 | if(!showMainList) { |
1214 | Lview->hide(); | 1219 | Lview->hide(); |
1215 | showMainList=TRUE; | 1220 | showMainList=TRUE; |
1216 | mainList->show(); | 1221 | mainList->show(); |
1217 | fillWithTitles(); | 1222 | fillWithTitles(); |
1218 | qApp->processEvents(); | 1223 | qApp->processEvents(); |
1219 | } | 1224 | } |
1220 | if(donateMenu->idAt(3) != -1) | 1225 | if(donateMenu->idAt(3) != -1) |
1221 | donateMenu->removeItemAt(3); | 1226 | donateMenu->removeItemAt(3); |
1222 | } | 1227 | } |
@@ -1225,27 +1230,27 @@ void Gutenbrowser::ClearEdit() { | |||
1225 | bool Gutenbrowser::getTitle( const char *file ) { | 1230 | bool Gutenbrowser::getTitle( const char *file ) { |
1226 | QString s_file; | 1231 | QString s_file; |
1227 | QString filer = file; | 1232 | QString filer = file; |
1228 | if( filer.contains(local_library, TRUE)) { | 1233 | if( filer.contains(local_library, TRUE)) { |
1229 | QFileInfo f(file); | 1234 | QFileInfo f(file); |
1230 | s_file = f.fileName(); | 1235 | s_file = f.fileName(); |
1231 | } else { | 1236 | } else { |
1232 | s_file = filer; | 1237 | s_file = filer; |
1233 | } | 1238 | } |
1234 | Config config("Gutenbrowser"); | 1239 | Config config("Gutenbrowser"); |
1235 | config.setGroup( "Files" ); | 1240 | config.setGroup( "Files" ); |
1236 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); | 1241 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); |
1237 | int i_numofFiles = s_numofFiles.toInt(); | 1242 | int i_numofFiles = s_numofFiles.toInt(); |
1238 | 1243 | ||
1239 | for (int i = 1; i <= i_numofFiles; i++) { | 1244 | for (int i = 1; i <= i_numofFiles; i++) { |
1240 | QString temp; | 1245 | QString temp; |
1241 | temp.setNum(i); | 1246 | temp.setNum(i); |
1242 | QString ramble = config.readEntry(temp, "" ); | 1247 | QString ramble = config.readEntry(temp, "" ); |
1243 | 1248 | ||
1244 | if( strcmp(ramble, s_file) == 0) { | 1249 | if( strcmp(ramble, s_file) == 0) { |
1245 | config.setGroup( "Titles" ); | 1250 | config.setGroup( "Titles" ); |
1246 | title = config.readEntry(ramble, ""); | 1251 | title = config.readEntry(ramble, ""); |
1247 | // qDebug("(getTitle)title is being set as "+title); | 1252 | // odebug << "(getTitle)title is being set as "+title << oendl; |
1248 | } | 1253 | } |
1249 | } | 1254 | } |
1250 | return true; | 1255 | return true; |
1251 | } | 1256 | } |
@@ -1253,9 +1258,9 @@ bool Gutenbrowser::getTitle( const char *file ) { | |||
1253 | void Gutenbrowser::searchdone_slot() { | 1258 | void Gutenbrowser::searchdone_slot() { |
1254 | // if (!searchDlg) | 1259 | // if (!searchDlg) |
1255 | // return; | 1260 | // return; |
1256 | // searchDlg->hide(); | 1261 | // searchDlg->hide(); |
1257 | // Lview->setFocus(); | 1262 | // Lview->setFocus(); |
1258 | this->setFocus(); | 1263 | this->setFocus(); |
1259 | last_search = 0; | 1264 | last_search = 0; |
1260 | // ResizeEdits(); | 1265 | // ResizeEdits(); |
1261 | } | 1266 | } |
@@ -1263,3 +1268,3 @@ void Gutenbrowser::searchdone_slot() { | |||
1263 | /* | 1268 | /* |
1264 | sets the status message */ | 1269 | sets the status message */ |
1265 | bool Gutenbrowser::setStatus() { | 1270 | bool Gutenbrowser::setStatus() { |
@@ -1267,20 +1272,20 @@ bool Gutenbrowser::setStatus() { | |||
1267 | #ifndef Q_WS_QWS | 1272 | #ifndef Q_WS_QWS |
1268 | QString s_pages; | 1273 | QString s_pages; |
1269 | s_pages.setNum( pages); | 1274 | s_pages.setNum( pages); |
1270 | QString chNum; | 1275 | QString chNum; |
1271 | statusTop = status.left( status.find(" ", TRUE) ); | 1276 | statusTop = status.left( status.find(" ", TRUE) ); |
1272 | status.append(chNum.setNum( i_pageNum)); | 1277 | status.append(chNum.setNum( i_pageNum)); |
1273 | status += " / " + s_pages; | 1278 | status += " / " + s_pages; |
1274 | 1279 | ||
1275 | if(loadCheck) { | 1280 | if(loadCheck) { |
1276 | statusBar->message( status); | 1281 | statusBar->message( status); |
1277 | InfoBar->setText( title); | 1282 | InfoBar->setText( title); |
1278 | } else { | 1283 | } else { |
1279 | } | 1284 | } |
1280 | #else | 1285 | #else |
1281 | QString msg; | 1286 | QString msg; |
1282 | msg.sprintf(title+" %d", i_pageNum); | 1287 | msg.sprintf(title+" %d", i_pageNum); |
1283 | setCaption( msg); | 1288 | setCaption( msg); |
1284 | #endif | 1289 | #endif |
1285 | return true; | 1290 | return true; |
1286 | } | 1291 | } |
@@ -1288,74 +1293,74 @@ bool Gutenbrowser::setStatus() { | |||
1288 | void Gutenbrowser::keyReleaseEvent( QKeyEvent *e) { | 1293 | void Gutenbrowser::keyReleaseEvent( QKeyEvent *e) { |
1289 | switch ( e->key() ) { | 1294 | switch ( e->key() ) { |
1290 | 1295 | ||
1291 | case Key_M: | 1296 | case Key_M: |
1292 | // Bookmark(); | 1297 | // Bookmark(); |
1293 | break; | 1298 | break; |
1294 | case Key_D: | 1299 | case Key_D: |
1295 | DownloadIndex(); | 1300 | DownloadIndex(); |
1296 | break; | 1301 | break; |
1297 | case Key_L: | 1302 | case Key_L: |
1298 | LibraryBtn(); | 1303 | LibraryBtn(); |
1299 | break; | 1304 | break; |
1300 | case Key_O: | 1305 | case Key_O: |
1301 | OpenBtn(); | 1306 | OpenBtn(); |
1302 | break; | 1307 | break; |
1303 | case Key_F: | 1308 | case Key_F: |
1304 | ForwardBtn(); | 1309 | ForwardBtn(); |
1305 | break; | 1310 | break; |
1306 | case Key_B: | 1311 | case Key_B: |
1307 | BackBtn(); | 1312 | BackBtn(); |
1308 | break; | 1313 | break; |
1309 | case Key_P: | 1314 | case Key_P: |
1310 | PrintBtn(); | 1315 | PrintBtn(); |
1311 | break; | 1316 | break; |
1312 | case Key_S: | 1317 | case Key_S: |
1313 | SearchBtn(); | 1318 | SearchBtn(); |
1314 | break; | 1319 | break; |
1315 | case Key_E: | 1320 | case Key_E: |
1316 | ByeBye(); | 1321 | ByeBye(); |
1317 | break; | 1322 | break; |
1318 | case Key_R: | 1323 | case Key_R: |
1319 | // setBookmark(); | 1324 | // setBookmark(); |
1320 | break; | 1325 | break; |
1321 | case Key_T: | 1326 | case Key_T: |
1322 | ChangeFont(); | 1327 | ChangeFont(); |
1323 | break; | 1328 | break; |
1324 | case Key_C: | 1329 | case Key_C: |
1325 | ClearEdit(); | 1330 | ClearEdit(); |
1326 | break; | 1331 | break; |
1327 | case Key_H: | 1332 | case Key_H: |
1328 | HelpBtn(); | 1333 | HelpBtn(); |
1329 | break; | 1334 | break; |
1330 | case Key_K: | 1335 | case Key_K: |
1331 | LookupBtn(); | 1336 | LookupBtn(); |
1332 | break; | 1337 | break; |
1333 | case Key_U:// hide menu | 1338 | case Key_U:// hide menu |
1334 | if(menubar->isHidden() ) | 1339 | if(menubar->isHidden() ) |
1335 | menubar->show(); | 1340 | menubar->show(); |
1336 | else | 1341 | else |
1337 | menubar->hide(); | 1342 | menubar->hide(); |
1338 | break; | 1343 | break; |
1339 | case Key_I: | 1344 | case Key_I: |
1340 | hideButtons(); | 1345 | hideButtons(); |
1341 | break; | 1346 | break; |
1342 | ////////////////////////////// Zaurus keys | 1347 | ////////////////////////////// Zaurus keys |
1343 | case Key_Home: | 1348 | case Key_Home: |
1344 | // BeginBtn(); | 1349 | // BeginBtn(); |
1345 | break; | 1350 | break; |
1346 | case Key_F9: //activity | 1351 | case Key_F9: //activity |
1347 | OpenBtn(); | 1352 | OpenBtn(); |
1348 | break; | 1353 | break; |
1349 | case Key_F10: //contacts | 1354 | case Key_F10: //contacts |
1350 | hideButtons(); | 1355 | hideButtons(); |
1351 | break; | 1356 | break; |
1352 | case Key_F11: //menu | 1357 | case Key_F11: //menu |
1353 | if(menubar->isHidden() ) | 1358 | if(menubar->isHidden() ) |
1354 | menubar->show(); | 1359 | menubar->show(); |
1355 | else | 1360 | else |
1356 | menubar->hide(); | 1361 | menubar->hide(); |
1357 | break; | 1362 | break; |
1358 | case Key_F12: //home | 1363 | case Key_F12: //home |
1359 | BeginBtn(); | 1364 | BeginBtn(); |
1360 | break; | 1365 | break; |
1361 | case Key_F13: //mail | 1366 | case Key_F13: //mail |
@@ -1363,60 +1368,60 @@ void Gutenbrowser::keyReleaseEvent( QKeyEvent *e) { | |||
1363 | break; | 1368 | break; |
1364 | case Key_Space: | 1369 | case Key_Space: |
1365 | if(loadCheck) | 1370 | if(loadCheck) |
1366 | ForwardBtn(); | 1371 | ForwardBtn(); |
1367 | // else | 1372 | // else |
1368 | // Bookmark(); | 1373 | // Bookmark(); |
1369 | break; | 1374 | break; |
1370 | case Key_Down: | 1375 | case Key_Down: |
1371 | if(loadCheck) { | 1376 | if(loadCheck) { |
1372 | // if( !e->isAutoRepeat() ) | 1377 | // if( !e->isAutoRepeat() ) |
1373 | // AdjustStatus(); | 1378 | // AdjustStatus(); |
1374 | // } else { | 1379 | // } else { |
1375 | // LibraryBtn(); | 1380 | // LibraryBtn(); |
1376 | // ForwardBtn(); | 1381 | // ForwardBtn(); |
1377 | } | 1382 | } |
1378 | 1383 | ||
1379 | // ForwardButton->setFocus(); | 1384 | // ForwardButton->setFocus(); |
1380 | // Lview->setFocus(); | 1385 | // Lview->setFocus(); |
1381 | // if(s_Wrap=="FALSE") | 1386 | // if(s_Wrap=="FALSE") |
1382 | // Lview->MultiLine_Ex::ScrollDown( 1); | 1387 | // Lview->MultiLine_Ex::ScrollDown( 1); |
1383 | // LibraryBtn(); | 1388 | // LibraryBtn(); |
1384 | break; | 1389 | break; |
1385 | case Key_Up: | 1390 | case Key_Up: |
1386 | if(loadCheck) { | 1391 | if(loadCheck) { |
1387 | // if( !e->isAutoRepeat() ) | 1392 | // if( !e->isAutoRepeat() ) |
1388 | // AdjustStatus(); | 1393 | // AdjustStatus(); |
1389 | // } else { | 1394 | // } else { |
1390 | // OpenBtn(); | 1395 | // OpenBtn(); |
1391 | // BackBtn(); | 1396 | // BackBtn(); |
1392 | } | 1397 | } |
1393 | // BackButton->setFocus(); | 1398 | // BackButton->setFocus(); |
1394 | // Lview->setFocus(); | 1399 | // Lview->setFocus(); |
1395 | // if(s_Wrap=="FALSE") | 1400 | // if(s_Wrap=="FALSE") |
1396 | // Lview->MultiLine_Ex::ScrollUp( 1); | 1401 | // Lview->MultiLine_Ex::ScrollUp( 1); |
1397 | 1402 | ||
1398 | // LibraryBtn(); | 1403 | // LibraryBtn(); |
1399 | break; | 1404 | break; |
1400 | case Key_Right: | 1405 | case Key_Right: |
1401 | ForwardButton->setFocus(); | 1406 | ForwardButton->setFocus(); |
1402 | ForwardBtn(); | 1407 | ForwardBtn(); |
1403 | // LibraryBtn(); | 1408 | // LibraryBtn(); |
1404 | break; | 1409 | break; |
1405 | case Key_Left: | 1410 | case Key_Left: |
1406 | BackBtn(); | 1411 | BackBtn(); |
1407 | BackButton->setFocus(); | 1412 | BackButton->setFocus(); |
1408 | // OpenBtn(); | 1413 | // OpenBtn(); |
1409 | break; | 1414 | break; |
1410 | case Key_Escape: | 1415 | case Key_Escape: |
1411 | ByeBye(); | 1416 | ByeBye(); |
1412 | break; | 1417 | break; |
1413 | case Key_PageUp: | 1418 | case Key_PageUp: |
1414 | BackBtn(); | 1419 | BackBtn(); |
1415 | break; | 1420 | break; |
1416 | case Key_PageDown: | 1421 | case Key_PageDown: |
1417 | ForwardBtn(); | 1422 | ForwardBtn(); |
1418 | break; | 1423 | break; |
1419 | 1424 | ||
1420 | ////////////////////////////// Zaurus keys | 1425 | ////////////////////////////// Zaurus keys |
1421 | }; | 1426 | }; |
1422 | } | 1427 | } |
@@ -1424,23 +1429,23 @@ void Gutenbrowser::keyReleaseEvent( QKeyEvent *e) { | |||
1424 | void Gutenbrowser::keyPressEvent( QKeyEvent *e) { | 1429 | void Gutenbrowser::keyPressEvent( QKeyEvent *e) { |
1425 | switch ( e->key() ) { | 1430 | switch ( e->key() ) { |
1426 | // case Key_Next: | 1431 | // case Key_Next: |
1427 | // ForwardBtn(); | 1432 | // ForwardBtn(); |
1428 | // break; | 1433 | // break; |
1429 | // case Key_Prior: | 1434 | // case Key_Prior: |
1430 | // BackBtn(); | 1435 | // BackBtn(); |
1431 | // break; | 1436 | // break; |
1432 | // case Key_Space: | 1437 | // case Key_Space: |
1433 | // ForwardBtn(); | 1438 | // ForwardBtn(); |
1434 | // break; | 1439 | // break; |
1435 | // case Key_Down: | 1440 | // case Key_Down: |
1436 | // Lview->MultiLine_Ex::ScrollUp( 1); | 1441 | // Lview->MultiLine_Ex::ScrollUp( 1); |
1437 | // if(useSplitter) Rview->MultiLine_Ex::ScrollUp( 1); | 1442 | // if(useSplitter) Rview->MultiLine_Ex::ScrollUp( 1); |
1438 | // break; | 1443 | // break; |
1439 | // case Key_Up: | 1444 | // case Key_Up: |
1440 | // if( Lview->Top() != 0) { | 1445 | // if( Lview->Top() != 0) { |
1441 | // Lview->MultiLine_Ex::ScrollDown( 1); | 1446 | // Lview->MultiLine_Ex::ScrollDown( 1); |
1442 | // if(useSplitter) Rview->MultiLine_Ex::ScrollDown( 1); | 1447 | // if(useSplitter) Rview->MultiLine_Ex::ScrollDown( 1); |
1443 | // } | 1448 | // } |
1444 | // break; | 1449 | // break; |
1445 | } | 1450 | } |
1446 | } | 1451 | } |
@@ -1448,11 +1453,11 @@ void Gutenbrowser::keyPressEvent( QKeyEvent *e) { | |||
1448 | void Gutenbrowser::resizeEvent( QResizeEvent *ev) { | 1453 | void Gutenbrowser::resizeEvent( QResizeEvent *ev) { |
1449 | // qDebug("resize: %d,%d\n",ev->size().width(),ev->size().height()); | 1454 | // odebug << "resize: " << ev->size().width() << "," << ev->size().height() << "\n" << oendl; |
1450 | 1455 | ||
1451 | if( !LibraryDlg->isHidden()) | 1456 | if( !LibraryDlg->isHidden()) |
1452 | LibraryDlg->resize(ev->size().width(),ev->size().height() ); | 1457 | LibraryDlg->resize(ev->size().width(),ev->size().height() ); |
1453 | 1458 | ||
1454 | // if( loadCheck == true) { | 1459 | // if( loadCheck == true) { |
1455 | // ResizeEdits(); | 1460 | // ResizeEdits(); |
1456 | // AdjustStatus(); | 1461 | // AdjustStatus(); |
1457 | // } | 1462 | // } |
1458 | } | 1463 | } |
@@ -1461,43 +1466,43 @@ void Gutenbrowser::resizeEvent( QResizeEvent *ev) { | |||
1461 | void Gutenbrowser::doOptions() { | 1466 | void Gutenbrowser::doOptions() { |
1462 | optionsDialog* optDlg; | 1467 | optionsDialog* optDlg; |
1463 | optDlg = new optionsDialog( this,"Options_Dlg", true); | 1468 | optDlg = new optionsDialog( this,"Options_Dlg", true); |
1464 | QString Ddir; | 1469 | QString Ddir; |
1465 | Config config("Gutenbrowser"); | 1470 | Config config("Gutenbrowser"); |
1466 | config.setGroup( "General" ); | 1471 | config.setGroup( "General" ); |
1467 | QFont myFont; | 1472 | QFont myFont; |
1468 | optDlg->showMaximized(); | 1473 | optDlg->showMaximized(); |
1469 | 1474 | ||
1470 | if( optDlg->exec() !=0) { | 1475 | if( optDlg->exec() !=0) { |
1471 | qApp->processEvents(); | 1476 | qApp->processEvents(); |
1472 | brow=optDlg->browserName; | 1477 | brow=optDlg->browserName; |
1473 | toggleButtonIcons( optDlg->useIcon); | 1478 | toggleButtonIcons( optDlg->useIcon); |
1474 | ftp_host= optDlg->ftp_host; | 1479 | ftp_host= optDlg->ftp_host; |
1475 | ftp_base_dir= optDlg->ftp_base_dir; | 1480 | ftp_base_dir= optDlg->ftp_base_dir; |
1476 | brow=optDlg->browserName; | 1481 | brow=optDlg->browserName; |
1477 | Ddir=optDlg->downloadDirEdit->text(); | 1482 | Ddir=optDlg->downloadDirEdit->text(); |
1478 | 1483 | ||
1479 | qDebug("writing library config"); | 1484 | odebug << "writing library config" << oendl; |
1480 | Config config("Gutenbrowser"); | 1485 | Config config("Gutenbrowser"); |
1481 | config.setGroup("General"); | 1486 | config.setGroup("General"); |
1482 | 1487 | ||
1483 | QString dirname= optDlg->downloadDirEdit->text(); | 1488 | QString dirname= optDlg->downloadDirEdit->text(); |
1484 | if(dirname.right(1)!="/") | 1489 | if(dirname.right(1)!="/") |
1485 | dirname+="/"; | 1490 | dirname+="/"; |
1486 | config.writeEntry( "DownloadDirectory",dirname); | 1491 | config.writeEntry( "DownloadDirectory",dirname); |
1487 | QDir newDir( optDlg->downloadDirEdit->text()); | 1492 | QDir newDir( optDlg->downloadDirEdit->text()); |
1488 | 1493 | ||
1489 | if( !newDir.exists() ) { | 1494 | if( !newDir.exists() ) { |
1490 | int exit=QMessageBox::information(this, "Note", "Ok, to make a new directory\n"+Ddir+" ?", | 1495 | int exit=QMessageBox::information(this, "Note", "Ok, to make a new directory\n"+Ddir+" ?", |
1491 | QMessageBox::Ok, QMessageBox::Cancel); | 1496 | QMessageBox::Ok, QMessageBox::Cancel); |
1492 | if (exit==1) { | 1497 | if (exit==1) { |
1493 | QString cmd="mkdir -p "; | 1498 | QString cmd="mkdir -p "; |
1494 | cmd+=Ddir.latin1(); | 1499 | cmd+=Ddir.latin1(); |
1495 | system(cmd); | 1500 | system(cmd); |
1496 | qDebug("Making new dir "+cmd); | 1501 | odebug << "Making new dir "+cmd << oendl; |
1497 | if(Ddir.right(1)!="/") { | 1502 | if(Ddir.right(1)!="/") { |
1498 | Ddir+="/"; | 1503 | Ddir+="/"; |
1499 | } | 1504 | } |
1500 | config.writeEntry("DownloadDirectory",Ddir); | 1505 | config.writeEntry("DownloadDirectory",Ddir); |
1501 | } | 1506 | } |
1502 | } | 1507 | } |
1503 | 1508 | ||
@@ -1505,37 +1510,37 @@ void Gutenbrowser::doOptions() { | |||
1505 | // setStyle( optDlg->styleInt); | 1510 | // setStyle( optDlg->styleInt); |
1506 | if(optDlg->b_qExit==TRUE) | 1511 | if(optDlg->b_qExit==TRUE) |
1507 | b_queryExit=TRUE; | 1512 | b_queryExit=TRUE; |
1508 | else | 1513 | else |
1509 | b_queryExit=FALSE; | 1514 | b_queryExit=FALSE; |
1510 | 1515 | ||
1511 | if(optDlg->fontDlg-> changedFonts) { | 1516 | if(optDlg->fontDlg-> changedFonts) { |
1512 | qDebug("Setting font"); | 1517 | odebug << "Setting font" << oendl; |
1513 | myFont=optDlg->fontDlg->selectedFont; | 1518 | myFont=optDlg->fontDlg->selectedFont; |
1514 | Lview->setFont( myFont); | 1519 | Lview->setFont( myFont); |
1515 | } | 1520 | } |
1516 | 1521 | ||
1517 | if(optDlg->useWordWrap_CheckBox->isChecked() ) { | 1522 | if(optDlg->useWordWrap_CheckBox->isChecked() ) { |
1518 | qDebug("WORD WRAP is set"); | 1523 | odebug << "WORD WRAP is set" << oendl; |
1519 | Lview->setWordWrap(QMultiLineEdit::WidgetWidth); | 1524 | Lview->setWordWrap(QMultiLineEdit::WidgetWidth); |
1520 | useWrap=true; | 1525 | useWrap=true; |
1521 | } else { | 1526 | } else { |
1522 | qDebug("Word wrap is NOT set"); | 1527 | odebug << "Word wrap is NOT set" << oendl; |
1523 | Lview->setWordWrap(QMultiLineEdit::NoWrap); | 1528 | Lview->setWordWrap(QMultiLineEdit::NoWrap); |
1524 | useWrap=false; | 1529 | useWrap=false; |
1525 | } | 1530 | } |
1526 | } | 1531 | } |
1527 | if(showMainList) { | 1532 | if(showMainList) { |
1528 | if(!Lview->isHidden()) | 1533 | if(!Lview->isHidden()) |
1529 | Lview->hide(); | 1534 | Lview->hide(); |
1530 | qApp->processEvents(); | 1535 | qApp->processEvents(); |
1531 | if(mainList->isHidden()) | 1536 | if(mainList->isHidden()) |
1532 | mainList->show(); | 1537 | mainList->show(); |
1533 | fillWithTitles(); | 1538 | fillWithTitles(); |
1534 | } else { | 1539 | } else { |
1535 | Lview->show(); | 1540 | Lview->show(); |
1536 | showMainList=FALSE; | 1541 | showMainList=FALSE; |
1537 | mainList->hide(); | 1542 | mainList->hide(); |
1538 | } | 1543 | } |
1539 | qApp->processEvents(); | 1544 | qApp->processEvents(); |
1540 | update(); | 1545 | update(); |
1541 | } | 1546 | } |
@@ -1543,35 +1548,35 @@ void Gutenbrowser::doOptions() { | |||
1543 | bool Gutenbrowser::setTitle() { | 1548 | bool Gutenbrowser::setTitle() { |
1544 | if( file_name.contains( local_library)) { | 1549 | if( file_name.contains( local_library)) { |
1545 | QFileInfo f( file_name); | 1550 | QFileInfo f( file_name); |
1546 | QString s_file = f.fileName(); | 1551 | QString s_file = f.fileName(); |
1547 | file_name = s_file; | 1552 | file_name = s_file; |
1548 | } | 1553 | } |
1549 | 1554 | ||
1550 | int test = 0; | 1555 | int test = 0; |
1551 | Config config("Gutenbrowser"); | 1556 | Config config("Gutenbrowser"); |
1552 | config.setGroup( "Files" ); | 1557 | config.setGroup( "Files" ); |
1553 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); | 1558 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); |
1554 | int i_numofFiles = s_numofFiles.toInt(); | 1559 | int i_numofFiles = s_numofFiles.toInt(); |
1555 | 1560 | ||
1556 | for (int i = 1; i <= i_numofFiles; i++) { | 1561 | for (int i = 1; i <= i_numofFiles; i++) { |
1557 | QString temp; | 1562 | QString temp; |
1558 | temp.setNum(i); | 1563 | temp.setNum(i); |
1559 | QString ramble = config.readEntry(temp, "" ); | 1564 | QString ramble = config.readEntry(temp, "" ); |
1560 | 1565 | ||
1561 | if( strcmp(ramble, file_name) == 0) { | 1566 | if( strcmp(ramble, file_name) == 0) { |
1562 | test = 1; | 1567 | test = 1; |
1563 | } | 1568 | } |
1564 | } | 1569 | } |
1565 | if (test == 0) { | 1570 | if (test == 0) { |
1566 | config.writeEntry("NumberOfFiles",i_numofFiles +1 ); | 1571 | config.writeEntry("NumberOfFiles",i_numofFiles +1 ); |
1567 | QString interger; | 1572 | QString interger; |
1568 | interger.setNum( i_numofFiles +1); | 1573 | interger.setNum( i_numofFiles +1); |
1569 | config.writeEntry(interger, file_name); | 1574 | config.writeEntry(interger, file_name); |
1570 | 1575 | ||
1571 | config.setGroup( "Titles" ); | 1576 | config.setGroup( "Titles" ); |
1572 | config.writeEntry(file_name,listItemTitle); | 1577 | config.writeEntry(file_name,listItemTitle); |
1573 | } | 1578 | } |
1574 | test = 0; | 1579 | test = 0; |
1575 | // config.write(); | 1580 | // config.write(); |
1576 | return true; | 1581 | return true; |
1577 | } | 1582 | } |
@@ -1580,13 +1585,13 @@ void Gutenbrowser::OnNetworkDialog( const QString &/*networkUrl*/, const QString | |||
1580 | { | 1585 | { |
1581 | // qDebug(networkUrl); | 1586 | // odebug << networkUrl << oendl; |
1582 | // qDebug(output); | 1587 | // odebug << output << oendl; |
1583 | // #ifndef Q_WS_QWS | 1588 | // #ifndef Q_WS_QWS |
1584 | // NetworkDialog *NetworkDlg; | 1589 | // NetworkDialog *NetworkDlg; |
1585 | // if( networkUrl.length() < 4 ) networkUrl= "http://sailor.gutenberg.org/mirror.sites.html"; | 1590 | // if( networkUrl.length() < 4 ) networkUrl= "http://sailor.gutenberg.org/mirror.sites.html"; |
1586 | // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkUrl, output); | 1591 | // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkUrl, output); |
1587 | // if( NetworkDlg->exec() != 0 ) { | 1592 | // if( NetworkDlg->exec() != 0 ) { |
1588 | // } | 1593 | // } |
1589 | // if(NetworkDlg) | 1594 | // if(NetworkDlg) |
1590 | // delete NetworkDlg; | 1595 | // delete NetworkDlg; |
1591 | // #endif | 1596 | // #endif |
1592 | } | 1597 | } |
@@ -1595,8 +1600,8 @@ void Gutenbrowser::donateGutenberg() | |||
1595 | { | 1600 | { |
1596 | int exit=QMessageBox::information(this,"Info", "http://www.gutenberg.org\ndonate@gutenberg.net", | 1601 | int exit=QMessageBox::information(this, "Info", "http://www.gutenberg.org\ndonate@gutenberg.net", |
1597 | QMessageBox::Ok, QMessageBox::Cancel); | 1602 | QMessageBox::Ok, QMessageBox::Cancel); |
1598 | 1603 | ||
1599 | if (exit==1) { | 1604 | if (exit==1) { |
1600 | } else { | 1605 | } else { |
1601 | }; | 1606 | }; |
1602 | } | 1607 | } |
@@ -1609,35 +1614,35 @@ void Gutenbrowser::writeConfig() | |||
1609 | { | 1614 | { |
1610 | // config.read(); | 1615 | // config.read(); |
1611 | // Config config("Gutenbrowser"); | 1616 | // Config config("Gutenbrowser"); |
1612 | // #ifndef Q_WS_QWS | 1617 | // #ifndef Q_WS_QWS |
1613 | // config.setGroup( "Geometry" ); | 1618 | // config.setGroup( "Geometry" ); |
1614 | // QString s; | 1619 | // QString s; |
1615 | // QString globalPosition; | 1620 | // QString globalPosition; |
1616 | // QPoint point; | 1621 | // QPoint point; |
1617 | // point=mapToGlobal(QPoint(0,0) ); | 1622 | // point=mapToGlobal(QPoint(0,0) ); |
1618 | // int posiX, posiY; | 1623 | // int posiX, posiY; |
1619 | // posiX=point.x(); | 1624 | // posiX=point.x(); |
1620 | // posiY=point.y(); | 1625 | // posiY=point.y(); |
1621 | // globalPosition.sprintf("%i,%i", posiX, posiY); | 1626 | // globalPosition.sprintf("%i,%i", posiX, posiY); |
1622 | 1627 | ||
1623 | // QRect frameRect; | 1628 | // QRect frameRect; |
1624 | // frameRect = geometry(); | 1629 | // frameRect = geometry(); |
1625 | // s.sprintf("%i,%i", frameRect.width(), frameRect.height()); | 1630 | // s.sprintf("%i,%i", frameRect.width(), frameRect.height()); |
1626 | // config.writeEntry("Frame", s); | 1631 | // config.writeEntry("Frame", s); |
1627 | // config.writeEntry("Position", globalPosition); | 1632 | // config.writeEntry("Position", globalPosition); |
1628 | 1633 | ||
1629 | // if( useIcons==TRUE) | 1634 | // if( useIcons==TRUE) |
1630 | // config.writeEntry("Icons", "TRUE"); | 1635 | // config.writeEntry("Icons", "TRUE"); |
1631 | // else | 1636 | // else |
1632 | // config.writeEntry("Icons", "FALSE"); | 1637 | // config.writeEntry("Icons", "FALSE"); |
1633 | // #endif | 1638 | // #endif |
1634 | 1639 | ||
1635 | // #ifndef Q_WS_QWS | 1640 | // #ifndef Q_WS_QWS |
1636 | // QString temp; | 1641 | // QString temp; |
1637 | // temp.setNum(styleI, 10); | 1642 | // temp.setNum(styleI, 10); |
1638 | // config.setGroup( "StyleIze" ); | 1643 | // config.setGroup( "StyleIze" ); |
1639 | // config.writeEntry( "Style", temp); | 1644 | // config.writeEntry( "Style", temp); |
1640 | // #endif | 1645 | // #endif |
1641 | 1646 | ||
1642 | // config.setGroup("General"); | 1647 | // config.setGroup("General"); |
1643 | } | 1648 | } |
@@ -1646,6 +1651,6 @@ void Gutenbrowser::annotations() | |||
1646 | { | 1651 | { |
1647 | // #ifndef Q_WS_QWS | 1652 | // #ifndef Q_WS_QWS |
1648 | // QMessageBox::message("Note","hi annotate"); | 1653 | // QMessageBox::message("Note","hi annotate"); |
1649 | // lastBmkButton->setDown(FALSE); | 1654 | // lastBmkButton->setDown(FALSE); |
1650 | // #endif | 1655 | // #endif |
1651 | } | 1656 | } |
@@ -1656,44 +1661,44 @@ void Gutenbrowser::hideButtons() | |||
1656 | if( !buttonsHidden) { | 1661 | if( !buttonsHidden) { |
1657 | buttonsHidden=TRUE; | 1662 | buttonsHidden=TRUE; |
1658 | LibraryButton->hide(); | 1663 | LibraryButton->hide(); |
1659 | SearchButton->hide(); | 1664 | SearchButton->hide(); |
1660 | InfoBar->hide(); | 1665 | InfoBar->hide(); |
1661 | OpenButton->hide(); | 1666 | OpenButton->hide(); |
1662 | BackButton->hide(); | 1667 | BackButton->hide(); |
1663 | ForwardButton->hide(); | 1668 | ForwardButton->hide(); |
1664 | setBookmarkButton->hide(); | 1669 | setBookmarkButton->hide(); |
1665 | lastBmkButton->hide(); | 1670 | lastBmkButton->hide(); |
1666 | dictionaryButton->hide(); | 1671 | dictionaryButton->hide(); |
1667 | if(useSplitter) { | 1672 | if(useSplitter) { |
1668 | ClearButton->hide(); | 1673 | ClearButton->hide(); |
1669 | PrintButton->hide(); | 1674 | PrintButton->hide(); |
1670 | beginButton->hide(); | 1675 | beginButton->hide(); |
1671 | HelpButton->hide(); | 1676 | HelpButton->hide(); |
1672 | FontButton->hide(); | 1677 | FontButton->hide(); |
1673 | ExitButton->hide(); | 1678 | ExitButton->hide(); |
1674 | OptionsButton->hide(); | 1679 | OptionsButton->hide(); |
1675 | DownloadButton->hide(); | 1680 | DownloadButton->hide(); |
1676 | } | 1681 | } |
1677 | } else { | 1682 | } else { |
1678 | buttonsHidden=FALSE; | 1683 | buttonsHidden=FALSE; |
1679 | 1684 | ||
1680 | LibraryButton->show(); | 1685 | LibraryButton->show(); |
1681 | SearchButton->show(); | 1686 | SearchButton->show(); |
1682 | InfoBar->show(); | 1687 | InfoBar->show(); |
1683 | OpenButton->show(); | 1688 | OpenButton->show(); |
1684 | BackButton->show(); | 1689 | BackButton->show(); |
1685 | ForwardButton->show(); | 1690 | ForwardButton->show(); |
1686 | setBookmarkButton->show(); | 1691 | setBookmarkButton->show(); |
1687 | lastBmkButton->show(); | 1692 | lastBmkButton->show(); |
1688 | dictionaryButton->show(); | 1693 | dictionaryButton->show(); |
1689 | if(useSplitter) { | 1694 | if(useSplitter) { |
1690 | ClearButton->show(); | 1695 | ClearButton->show(); |
1691 | PrintButton->show(); | 1696 | PrintButton->show(); |
1692 | beginButton->show(); | 1697 | beginButton->show(); |
1693 | HelpButton->show(); | 1698 | HelpButton->show(); |
1694 | FontButton->show(); | 1699 | FontButton->show(); |
1695 | ExitButton->show(); | 1700 | ExitButton->show(); |
1696 | OptionsButton->show(); | 1701 | OptionsButton->show(); |
1697 | DownloadButton->show(); | 1702 | DownloadButton->show(); |
1698 | } | 1703 | } |
1699 | } | 1704 | } |
@@ -1710,8 +1715,8 @@ void Gutenbrowser::cleanUp( ) | |||
1710 | { | 1715 | { |
1711 | writeConfig(); | 1716 | writeConfig(); |
1712 | QPEApplication::grabKeyboard(); | 1717 | QPEApplication::grabKeyboard(); |
1713 | 1718 | ||
1714 | QPEApplication::ungrabKeyboard(); | 1719 | QPEApplication::ungrabKeyboard(); |
1715 | // qDebug("Cleanup"); | 1720 | // odebug << "Cleanup" << oendl; |
1716 | if(f.isOpen()) f.close(); | 1721 | if(f.isOpen()) f.close(); |
1717 | } | 1722 | } |
@@ -1720,3 +1725,3 @@ void Gutenbrowser::fixKeys() | |||
1720 | { | 1725 | { |
1721 | qDebug("Attempting to fix keys"); | 1726 | odebug << "Attempting to fix keys" << oendl; |
1722 | 1727 | ||
@@ -1726,13 +1731,13 @@ void Gutenbrowser::enableButtons(bool b) | |||
1726 | { | 1731 | { |
1727 | BackButton->setEnabled(b); | 1732 | BackButton->setEnabled(b); |
1728 | ForwardButton->setEnabled(b); | 1733 | ForwardButton->setEnabled(b); |
1729 | SearchButton->setEnabled(b); | 1734 | SearchButton->setEnabled(b); |
1730 | setBookmarkButton->setEnabled(b); | 1735 | setBookmarkButton->setEnabled(b); |
1731 | dictionaryButton->setEnabled(b); | 1736 | dictionaryButton->setEnabled(b); |
1732 | InfoBar->setEnabled(b); | 1737 | InfoBar->setEnabled(b); |
1733 | 1738 | ||
1734 | editMenu->setItemEnabled( -5, b); | 1739 | editMenu->setItemEnabled( -5, b); |
1735 | editMenu->setItemEnabled( -6, b); | 1740 | editMenu->setItemEnabled( -6, b); |
1736 | editMenu->setItemEnabled( -7, b); | 1741 | editMenu->setItemEnabled( -7, b); |
1737 | editMenu->setItemEnabled( -8, b); | 1742 | editMenu->setItemEnabled( -8, b); |
1738 | 1743 | ||
@@ -1741,17 +1746,17 @@ void Gutenbrowser::enableButtons(bool b) | |||
1741 | void Gutenbrowser::fillWithTitles() { | 1746 | void Gutenbrowser::fillWithTitles() { |
1742 | Config config("Gutenbrowser"); | 1747 | Config config("Gutenbrowser"); |
1743 | config.setGroup( "Files" ); | 1748 | config.setGroup( "Files" ); |
1744 | int i_numofFiles = config.readNumEntry("NumberOfFiles", 0); | 1749 | int i_numofFiles = config.readNumEntry("NumberOfFiles", 0); |
1745 | mainList->clear(); | 1750 | mainList->clear(); |
1746 | QString temp; | 1751 | QString temp; |
1747 | for (int i = 1; i <= i_numofFiles; i++) { | 1752 | for (int i = 1; i <= i_numofFiles; i++) { |
1748 | temp.setNum(i); | 1753 | temp.setNum(i); |
1749 | config.setGroup( "Files" ); | 1754 | config.setGroup( "Files" ); |
1750 | QString ramble = config.readEntry(temp, "" ); | 1755 | QString ramble = config.readEntry(temp, "" ); |
1751 | config.setGroup( "Titles" ); | 1756 | config.setGroup( "Titles" ); |
1752 | temp = config.readEntry(ramble, ""); | 1757 | temp = config.readEntry(ramble, ""); |
1753 | if( !temp.isEmpty()) { | 1758 | if( !temp.isEmpty()) { |
1754 | mainList->insertItem ( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), temp, -1); | 1759 | mainList->insertItem ( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), temp, -1); |
1755 | } | 1760 | } |
1756 | } | 1761 | } |
1757 | } | 1762 | } |
@@ -1759,38 +1764,38 @@ void Gutenbrowser::fillWithTitles() { | |||
1759 | void Gutenbrowser::listClickedSlot( QListBoxItem * index) { | 1764 | void Gutenbrowser::listClickedSlot( QListBoxItem * index) { |
1760 | // if( !working) { | 1765 | // if( !working) { |
1761 | // working=true; | 1766 | // working=true; |
1762 | if(index) { | 1767 | if(index) { |
1763 | // QCopEnvelope ( "QPE/System", "busy()" ); | 1768 | // QCopEnvelope ( "QPE/System", "busy()" ); |
1764 | title = index->text(); | 1769 | title = index->text(); |
1765 | showMainList=FALSE; | 1770 | showMainList=FALSE; |
1766 | mainList->hide(); | 1771 | mainList->hide(); |
1767 | Lview->show(); | 1772 | Lview->show(); |
1768 | qApp->processEvents(); | 1773 | qApp->processEvents(); |
1769 | QString temp; | 1774 | QString temp; |
1770 | temp.setNum( mainList->currentItem() + 1); | 1775 | temp.setNum( mainList->currentItem() + 1); |
1771 | // openFileTitle = title; | 1776 | // openFileTitle = title; |
1772 | Config config("Gutenbrowser"); | 1777 | Config config("Gutenbrowser"); |
1773 | config.setGroup( "Files" ); | 1778 | config.setGroup( "Files" ); |
1774 | QString file = config.readEntry(temp, ""); | 1779 | QString file = config.readEntry(temp, ""); |
1775 | qDebug("About to load"); | 1780 | odebug << "About to load" << oendl; |
1776 | if( Lview->isVisible()) | 1781 | if( Lview->isVisible()) |
1777 | load(file); | 1782 | load(file); |
1778 | 1783 | ||
1779 | config.setGroup( title); | 1784 | config.setGroup( title); |
1780 | file_name = config.readEntry("File Name", ""); | 1785 | file_name = config.readEntry("File Name", ""); |
1781 | i_pageNum = config.readNumEntry("Page Number", 1); | 1786 | i_pageNum = config.readNumEntry("Page Number", 1); |
1782 | int Bmrkrow = config.readNumEntry("LineNumber", -1); | 1787 | int Bmrkrow = config.readNumEntry("LineNumber", -1); |
1783 | if(Bmrkrow > -1) { | 1788 | if(Bmrkrow > -1) { |
1784 | if( Bmrkrow > Lview->topRow() ) { | 1789 | if( Bmrkrow > Lview->topRow() ) { |
1785 | Lview->setCursorPosition( Bmrkrow /* - Lview->topRow() */,0, FALSE ); | 1790 | Lview->setCursorPosition( Bmrkrow /* - Lview->topRow() */,0, FALSE ); |
1786 | Lview->ScrollUp( Bmrkrow - Lview->topRow() ); | 1791 | Lview->ScrollUp( Bmrkrow - Lview->topRow() ); |
1787 | // AdjustStatus(); | 1792 | // AdjustStatus(); |
1788 | } | 1793 | } |
1789 | else if( Bmrkrow < Lview->topRow() ) { | 1794 | else if( Bmrkrow < Lview->topRow() ) { |
1790 | Lview->setCursorPosition( Lview->topRow() - Bmrkrow ,0, FALSE ); | 1795 | Lview->setCursorPosition( Lview->topRow() - Bmrkrow ,0, FALSE ); |
1791 | Lview->ScrollDown( Lview->topRow() - Bmrkrow ); | 1796 | Lview->ScrollDown( Lview->topRow() - Bmrkrow ); |
1792 | // AdjustStatus(); | 1797 | // AdjustStatus(); |
1793 | } | 1798 | } |
1794 | } | 1799 | } |
1795 | } | 1800 | } |
1796 | } | 1801 | } |
@@ -1798,5 +1803,5 @@ void Gutenbrowser::listClickedSlot( QListBoxItem * index) { | |||
1798 | void Gutenbrowser::infoGutenbrowser() { | 1803 | void Gutenbrowser::infoGutenbrowser() { |
1799 | QMessageBox::message("Info","Gutenbrowser was developed by\n" | 1804 | QMessageBox::message("Info","Gutenbrowser was developed by\n" |
1800 | "Lorn Potter\n" | 1805 | "Lorn Potter\n" |
1801 | "ljp<ljp@llornkcor.com>\n"); | 1806 | "ljp<ljp@llornkcor.com>\n"); |
1802 | } | 1807 | } |
@@ -1804,20 +1809,20 @@ void Gutenbrowser::infoGutenbrowser() { | |||
1804 | void Gutenbrowser::setDocument(const QString & frozenBoogers) { | 1809 | void Gutenbrowser::setDocument(const QString & frozenBoogers) { |
1805 | this->hide(); | 1810 | this->hide(); |
1806 | if(showMainList) { | 1811 | if(showMainList) { |
1807 | showMainList=FALSE; | 1812 | showMainList=FALSE; |
1808 | if(!mainList->isHidden()) | 1813 | if(!mainList->isHidden()) |
1809 | mainList->hide(); | 1814 | mainList->hide(); |
1810 | if(Lview->isHidden()) | 1815 | if(Lview->isHidden()) |
1811 | Lview->show(); | 1816 | Lview->show(); |
1812 | qApp->processEvents(); | 1817 | qApp->processEvents(); |
1813 | } | 1818 | } |
1814 | DocLnk lnk; | 1819 | DocLnk lnk; |
1815 | lnk = DocLnk(frozenBoogers); | 1820 | lnk = DocLnk(frozenBoogers); |
1816 | // qDebug(lnk.file() ); | 1821 | // odebug << lnk.file() << oendl; |
1817 | title=lnk.comment(); | 1822 | title=lnk.comment(); |
1818 | load( lnk.file()); | 1823 | load( lnk.file()); |
1819 | this->show(); | 1824 | this->show(); |
1820 | // qDebug(title); | 1825 | // odebug << title << oendl; |
1821 | // qApp->processEvents(); | 1826 | // qApp->processEvents(); |
1822 | // repaint(); | 1827 | // repaint(); |
1823 | } | 1828 | } |
@@ -1826,17 +1831,17 @@ void Gutenbrowser::mainListPressed(int mouse, QListBoxItem * , const QPoint & ) | |||
1826 | { | 1831 | { |
1827 | switch (mouse) { | 1832 | switch (mouse) { |
1828 | case 1: | 1833 | case 1: |
1829 | break; | 1834 | break; |
1830 | case 2: { | 1835 | case 2: { |
1831 | QPopupMenu m;// = new QPopupMenu( Local_View ); | 1836 | QPopupMenu m;// = new QPopupMenu( Local_View ); |
1832 | m.insertItem( tr( "Open" ), this, SLOT( menuOpen() )); | 1837 | m.insertItem( tr( "Open" ), this, SLOT( menuOpen() )); |
1833 | m.insertSeparator(); | 1838 | m.insertSeparator(); |
1834 | m.insertItem( tr( "Search google.com" ), this, SLOT( menuGoogle())); | 1839 | m.insertItem( tr( "Search google.com" ), this, SLOT( menuGoogle())); |
1835 | m.insertItem( tr( "Edit Title" ), this, SLOT( menuEditTitle())); | 1840 | m.insertItem( tr( "Edit Title" ), this, SLOT( menuEditTitle())); |
1836 | // m.insertSeparator(); | 1841 | // m.insertSeparator(); |
1837 | // m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 1842 | // m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
1838 | m.exec( QCursor::pos() ); | 1843 | m.exec( QCursor::pos() ); |
1839 | } | 1844 | } |
1840 | break; | 1845 | break; |
1841 | }; | 1846 | }; |
1842 | } | 1847 | } |
@@ -1844,3 +1849,3 @@ void Gutenbrowser::mainListPressed(int mouse, QListBoxItem * , const QPoint & ) | |||
1844 | void Gutenbrowser::menuOpen() { | 1849 | void Gutenbrowser::menuOpen() { |
1845 | listClickedSlot( mainList->item( mainList->currentItem())); | 1850 | listClickedSlot( mainList->item( mainList->currentItem())); |
1846 | } | 1851 | } |
@@ -1848,3 +1853,3 @@ void Gutenbrowser::menuOpen() { | |||
1848 | void Gutenbrowser::menuGoogle() { | 1853 | void Gutenbrowser::menuGoogle() { |
1849 | searchGoogle( mainList->text(mainList->currentItem())); | 1854 | searchGoogle( mainList->text(mainList->currentItem())); |
1850 | } | 1855 | } |
@@ -1852,18 +1857,18 @@ void Gutenbrowser::menuGoogle() { | |||
1852 | void Gutenbrowser::searchGoogle( const QString &tempText) { | 1857 | void Gutenbrowser::searchGoogle( const QString &tempText) { |
1853 | QString text = tempText; | 1858 | QString text = tempText; |
1854 | 1859 | ||
1855 | int eexit=QMessageBox::information(this, "Note","Do you want to search for\n"+text+ | 1860 | int eexit=QMessageBox::information(this, "Note","Do you want to search for\n"+text+ |
1856 | "\non google.com?",QMessageBox::Yes, QMessageBox::No); | 1861 | "\non google.com?",QMessageBox::Yes, QMessageBox::No); |
1857 | if (eexit== 3) { | 1862 | if (eexit== 3) { |
1858 | qApp->processEvents(); | 1863 | qApp->processEvents(); |
1859 | text.replace( QRegExp("\\s"), "%20"); | 1864 | text.replace( QRegExp("\\s"), "%20"); |
1860 | text.replace( QRegExp("#"), ""); | 1865 | text.replace( QRegExp("#"), ""); |
1861 | text.replace( QRegExp(","), "%20"); | 1866 | text.replace( QRegExp(","), "%20"); |
1862 | text.replace( QRegExp("'"), "%20"); | 1867 | text.replace( QRegExp("'"), "%20"); |
1863 | text.replace( QRegExp("("), ""); | 1868 | text.replace( QRegExp("("), ""); |
1864 | text.replace( QRegExp(")"), ""); | 1869 | text.replace( QRegExp(")"), ""); |
1865 | // text.replace( QRegExp("[0-9]"), ""); | 1870 | // text.replace( QRegExp("[0-9]"), ""); |
1866 | QString s_lookup = "http://google.com/search?q="+text+"&num=30&sa=Google+Search"; | 1871 | QString s_lookup = "http://google.com/search?q="+text+"&num=30&sa=Google+Search"; |
1867 | goGetit( s_lookup, true); | 1872 | goGetit( s_lookup, true); |
1868 | } | 1873 | } |
1869 | 1874 | ||
@@ -1873,36 +1878,36 @@ void Gutenbrowser::menuEditTitle() | |||
1873 | { | 1878 | { |
1874 | int currentItem = mainList->currentItem(); | 1879 | int currentItem = mainList->currentItem(); |
1875 | QString title_text = mainList->text( currentItem); | 1880 | QString title_text = mainList->text( currentItem); |
1876 | //qDebug("Selected "+title_text); | 1881 | //odebug << "Selected "+title_text << oendl; |
1877 | 1882 | ||
1878 | Config config("Gutenbrowser"); | 1883 | Config config("Gutenbrowser"); |
1879 | config.setGroup( "Files" ); | 1884 | config.setGroup( "Files" ); |
1880 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0"); | 1885 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0"); |
1881 | int i_numofFiles = s_numofFiles.toInt(); | 1886 | int i_numofFiles = s_numofFiles.toInt(); |
1882 | QString fileNum; | 1887 | QString fileNum; |
1883 | for (int i = 1; i <= i_numofFiles+1; i++) { | 1888 | for (int i = 1; i <= i_numofFiles+1; i++) { |
1884 | 1889 | ||
1885 | fileNum.setNum(i); | 1890 | fileNum.setNum(i); |
1886 | config.setGroup( "Files" ); | 1891 | config.setGroup( "Files" ); |
1887 | QString s_filename = config.readEntry(fileNum, "" ); | 1892 | QString s_filename = config.readEntry(fileNum, "" ); |
1888 | config.setGroup( "Titles" ); | 1893 | config.setGroup( "Titles" ); |
1889 | QString file_title = config.readEntry( s_filename, ""); | 1894 | QString file_title = config.readEntry( s_filename, ""); |
1890 | //qDebug("file_title is "+file_title); | 1895 | //odebug << "file_title is "+file_title << oendl; |
1891 | if(title_text == file_title ) { | 1896 | if(title_text == file_title ) { |
1892 | // selFile = s_filename; | 1897 | // selFile = s_filename; |
1893 | //qDebug("Edit: "+ file_title ); | 1898 | //odebug << "Edit: "+ file_title << oendl; |
1894 | i=i_numofFiles+1; | 1899 | i=i_numofFiles+1; |
1895 | Edit_Title *titleEdit; | 1900 | Edit_Title *titleEdit; |
1896 | titleEdit = new Edit_Title(this,file_title ,TRUE); | 1901 | titleEdit = new Edit_Title(this,file_title ,TRUE); |
1897 | if(titleEdit->exec() !=0) { | 1902 | if(titleEdit->exec() !=0) { |
1898 | //qDebug(titleEdit->newTitle); | 1903 | //odebug << titleEdit->newTitle << oendl; |
1899 | config.writeEntry( s_filename, titleEdit->newTitle); | 1904 | config.writeEntry( s_filename, titleEdit->newTitle); |
1900 | mainList->removeItem(currentItem); | 1905 | mainList->removeItem(currentItem); |
1901 | mainList->insertItem ( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), titleEdit->newTitle, currentItem); | 1906 | mainList->insertItem ( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), titleEdit->newTitle, currentItem); |
1902 | } | 1907 | } |
1903 | } | 1908 | } |
1904 | } | 1909 | } |
1905 | 1910 | ||
1906 | // getTitles(); | 1911 | // getTitles(); |
1907 | mainList->triggerUpdate(true); | 1912 | mainList->triggerUpdate(true); |
1908 | 1913 | ||
@@ -1913,70 +1918,70 @@ void Gutenbrowser::menuEditTitle() | |||
1913 | bool Gutenbrowser::UnZipIt(const QString &zipFile) { | 1918 | bool Gutenbrowser::UnZipIt(const QString &zipFile) { |
1914 | qDebug(zipFile); | 1919 | odebug << zipFile << oendl; |
1915 | #ifndef Q_WS_QWS | 1920 | #ifndef Q_WS_QWS |
1916 | if( QFile::exists( zipFile)) { // TODO findsome other way of dealingwithzip files. | 1921 | if( QFile::exists( zipFile)) { // TODO findsome other way of dealingwithzip files. |
1917 | bool isPgWhole=false; | 1922 | bool isPgWhole=false; |
1918 | QString thatFile; | 1923 | QString thatFile; |
1919 | if(zipFile.find("pgwhole",0,TRUE)) { | 1924 | if(zipFile.find("pgwhole",0,TRUE)) { |
1920 | isPgWhole=TRUE; | 1925 | isPgWhole=TRUE; |
1921 | thatFile= local_library +"PGWHOLE.TXT"; | 1926 | thatFile= local_library +"PGWHOLE.TXT"; |
1922 | } | 1927 | } |
1923 | // else { | 1928 | // else { |
1924 | // thatFile=zipFile.left(4); | 1929 | // thatFile=zipFile.left(4); |
1925 | // } | 1930 | // } |
1926 | // qDebug((const char*)local_library.latin1()); | 1931 | // odebug << (const char*)local_library.latin1() << oendl; |
1927 | QString cmd; | 1932 | QString cmd; |
1928 | #if defined(_WS_X11_) | 1933 | #if defined(_WS_X11_) |
1929 | if( chdir((const char*)local_library.latin1())!=0) | 1934 | if( chdir((const char*)local_library.latin1())!=0) |
1930 | qDebug("chdir failed."); | 1935 | odebug << "chdir failed." << oendl; |
1931 | cmd = "gunzip -S .zip " + local_library+zipFile; | 1936 | cmd = "gunzip -S .zip " + local_library+zipFile; |
1932 | //cmd = "gunzip -d " + zipFile /*newestLibraryFile */+" -d " + local_library; | 1937 | //cmd = "gunzip -d " + zipFile /*newestLibraryFile */+" -d " + local_library; |
1933 | #endif | 1938 | #endif |
1934 | #ifdef Q_WS_QWS | 1939 | #ifdef Q_WS_QWS |
1935 | if( chdir((const char*)local_library.latin1())!=0) | 1940 | if( chdir((const char*)local_library.latin1())!=0) |
1936 | qDebug("chdir failed."); | 1941 | odebug << "chdir failed." << oendl; |
1937 | cmd = "unzip " + local_library+zipFile; | 1942 | cmd = "unzip " + local_library+zipFile; |
1938 | // cmd = "/usr/bin/unzip -o " + local_library+zipFile +" -d /usr/share/doc/gutenbrowser" ;//+ local_library; | 1943 | // cmd = "/usr/bin/unzip -o " + local_library+zipFile +" -d /usr/share/doc/gutenbrowser" ;//+ local_library; |
1939 | #endif | 1944 | #endif |
1940 | int exit=QMessageBox::information(this, "Ok to unzip?", | 1945 | int exit=QMessageBox::information(this, "Ok to unzip?", |
1941 | "Ok to unnzip\n"+ zipFile+" ?", | 1946 | "Ok to unnzip\n"+ zipFile+" ?", |
1942 | QMessageBox::Yes, QMessageBox::No); | 1947 | QMessageBox::Yes, QMessageBox::No); |
1943 | if (exit==QMessageBox::Yes) { | 1948 | if (exit==QMessageBox::Yes) { |
1944 | #if defined(_WS_X11_)// | 1949 | #if defined(_WS_X11_)// |
1945 | qDebug("Issuing the command "+cmd); | 1950 | odebug << "Issuing the command "+cmd << oendl; |
1946 | system( cmd); | 1951 | system( cmd); |
1947 | if( QFile::exists(thatFile)) | 1952 | if( QFile::exists(thatFile)) |
1948 | remove (thatFile); | 1953 | remove (thatFile); |
1949 | if(isPgWhole) { | 1954 | if(isPgWhole) { |
1950 | if( rename("pgwhole","PGWHOLE.TXT") !=0) | 1955 | if( rename("pgwhole","PGWHOLE.TXT") !=0) |
1951 | qDebug("rename failed"); | 1956 | odebug << "rename failed" << oendl; |
1952 | } else { | 1957 | } else { |
1953 | if( rename(thatFile.left(4),thatFile.left(4)+".txt") !=0) | 1958 | if( rename(thatFile.left(4),thatFile.left(4)+".txt") !=0) |
1954 | qDebug("rename failed"); | 1959 | odebug << "rename failed" << oendl; |
1955 | } | 1960 | } |
1956 | #endif | 1961 | #endif |
1957 | #ifdef Q_WS_QWS | 1962 | #ifdef Q_WS_QWS |
1958 | qDebug("Issuing the command "+cmd); | 1963 | odebug << "Issuing the command "+cmd << oendl; |
1959 | system( cmd); | 1964 | system( cmd); |
1960 | if( QFile::exists(thatFile)) | 1965 | if( QFile::exists(thatFile)) |
1961 | remove(thatFile); | 1966 | remove(thatFile); |
1962 | if(isPgWhole) { | 1967 | if(isPgWhole) { |
1963 | if( rename("pgwhole","PGWHOLE.TXT") !=0) | 1968 | if( rename("pgwhole","PGWHOLE.TXT") !=0) |
1964 | qDebug("rename failed"); | 1969 | odebug << "rename failed" << oendl; |
1965 | } else { | 1970 | } else { |
1966 | if( rename(thatFile.left(4),thatFile.left(4)+".txt") !=0) | 1971 | if( rename(thatFile.left(4),thatFile.left(4)+".txt") !=0) |
1967 | qDebug("rename failed"); | 1972 | odebug << "rename failed" << oendl; |
1968 | } | 1973 | } |
1969 | #endif | 1974 | #endif |
1970 | // remove( zipFile); | 1975 | // remove( zipFile); |
1971 | return true; | 1976 | return true; |
1972 | } | 1977 | } |
1973 | else if(exit==QMessageBox::No) { | 1978 | else if(exit==QMessageBox::No) { |
1974 | // qDebug("unzip"); | 1979 | // odebug << "unzip" << oendl; |
1975 | return false; | 1980 | return false; |
1976 | } | 1981 | } |
1977 | } | 1982 | } |
1978 | else | 1983 | else |
1979 | QMessageBox::message( "Note",( tr("Please install unzip in your PATH")) ); | 1984 | QMessageBox::message( "Note",( tr("Please install unzip in your PATH")) ); |
1980 | #endif | 1985 | #endif |
1981 | return false; | 1986 | return false; |
1982 | } | 1987 | } |
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp index c9149ac..a226258 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp +++ b/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp | |||
@@ -13,2 +13,3 @@ | |||
13 | ***************************************************************************/ | 13 | ***************************************************************************/ |
14 | |||
14 | //#include "gutenbrowserData.h" | 15 | //#include "gutenbrowserData.h" |
@@ -16,2 +17,4 @@ | |||
16 | 17 | ||
18 | /* OPIE */ | ||
19 | #include <opie2/odebug.h> | ||
17 | #include <qpe/config.h> | 20 | #include <qpe/config.h> |
@@ -22,2 +25,3 @@ | |||
22 | 25 | ||
26 | /* QT */ | ||
23 | #include <qfontinfo.h> | 27 | #include <qfontinfo.h> |
@@ -37,3 +41,3 @@ void Gutenbrowser::initSlots() { | |||
37 | connect(mainList,SIGNAL(clicked(QListBoxItem *)),SLOT(listClickedSlot(QListBoxItem *))); | 41 | connect(mainList,SIGNAL(clicked(QListBoxItem *)),SLOT(listClickedSlot(QListBoxItem *))); |
38 | connect(bookmarksMenu,SIGNAL(activated(int)),SLOT(Bookmark(int))); | 42 | connect(bookmarksMenu,SIGNAL(activated(int)),SLOT(Bookmark(int))); |
39 | } | 43 | } |
@@ -41,3 +45,3 @@ void Gutenbrowser::initSlots() { | |||
41 | void Gutenbrowser::initConfig() { | 45 | void Gutenbrowser::initConfig() { |
42 | //qDebug("Starting configuration."); | 46 | //odebug << "Starting configuration." << oendl; |
43 | QDir library(local_library); | 47 | QDir library(local_library); |
@@ -59,3 +63,3 @@ void Gutenbrowser::initConfig() { | |||
59 | } | 63 | } |
60 | // qDebug( "init file is %s",iniFile.latin1()); | 64 | // odebug << "init file is " << iniFile << "" << oendl; |
61 | 65 | ||
@@ -139,3 +143,3 @@ void Gutenbrowser::initConfig() { | |||
139 | 143 | ||
140 | //bool ok2; | 144 | //bool ok2; |
141 | QString temp; | 145 | QString temp; |
@@ -149,5 +153,5 @@ void Gutenbrowser::initConfig() { | |||
149 | b_queryExit=TRUE; | 153 | b_queryExit=TRUE; |
150 | // qDebug("Please query before leaving the library."); | 154 | // odebug << "Please query before leaving the library." << oendl; |
151 | } else { | 155 | } else { |
152 | // qDebug("Please DO NOT query before leaving the library."); | 156 | // odebug << "Please DO NOT query before leaving the library." << oendl; |
153 | b_queryExit=FALSE; | 157 | b_queryExit=FALSE; |
@@ -157,3 +161,3 @@ void Gutenbrowser::initConfig() { | |||
157 | // QString tmpTitle=config.readEntry(file_name,""); | 161 | // QString tmpTitle=config.readEntry(file_name,""); |
158 | 162 | ||
159 | 163 | ||
@@ -163,3 +167,3 @@ void Gutenbrowser::initMenuBar() | |||
163 | { | 167 | { |
164 | // qDebug("Starting menu init."); | 168 | // odebug << "Starting menu init." << oendl; |
165 | // menuBar entry fileMenu | 169 | // menuBar entry fileMenu |
@@ -178,5 +182,5 @@ void Gutenbrowser::initMenuBar() | |||
178 | editMenu=new QPopupMenu(); | 182 | editMenu=new QPopupMenu(); |
179 | 183 | ||
180 | editMenu->insertItem(Resource::loadPixmap("up"), "Top", | 184 | editMenu->insertItem(Resource::loadPixmap("up"), "Top", |
181 | this, SLOT(TopBtn()) ); | 185 | this, SLOT(TopBtn()) ); |
182 | editMenu->insertItem( Resource::loadPixmap("back"), "Beginning", | 186 | editMenu->insertItem( Resource::loadPixmap("back"), "Beginning", |
@@ -185,3 +189,3 @@ void Gutenbrowser::initMenuBar() | |||
185 | this, SLOT(SearchBtn()) ); | 189 | this, SLOT(SearchBtn()) ); |
186 | 190 | ||
187 | editMenu->insertItem("Clear", this, SLOT(ClearEdit()) ); | 191 | editMenu->insertItem("Clear", this, SLOT(ClearEdit()) ); |
@@ -209,3 +213,3 @@ void Gutenbrowser::initButtonBar() | |||
209 | { | 213 | { |
210 | //qDebug("Starting buttonbar init."); | 214 | //odebug << "Starting buttonbar init." << oendl; |
211 | 215 | ||
@@ -224,3 +228,3 @@ void Gutenbrowser::initButtonBar() | |||
224 | // ForwardButton->setAutoRepeat(TRUE); | 228 | // ForwardButton->setAutoRepeat(TRUE); |
225 | 229 | ||
226 | SearchButton = new QPushButton( this, "SearchButton" ); | 230 | SearchButton = new QPushButton( this, "SearchButton" ); |
@@ -236,3 +240,3 @@ void Gutenbrowser::initButtonBar() | |||
236 | bookmarksMenu->insertItem("Last Set", this, SLOT(Bookmark( int) )); | 240 | bookmarksMenu->insertItem("Last Set", this, SLOT(Bookmark( int) )); |
237 | 241 | ||
238 | lastBmkButton->setPopup(bookmarksMenu); | 242 | lastBmkButton->setPopup(bookmarksMenu); |
@@ -243,3 +247,3 @@ void Gutenbrowser::initButtonBar() | |||
243 | InfoBar = new QPushButton( this, "Info_Bar" ); | 247 | InfoBar = new QPushButton( this, "Info_Bar" ); |
244 | // qDebug("Infobar"); | 248 | // odebug << "Infobar" << oendl; |
245 | // if(!useSplitter) { | 249 | // if(!useSplitter) { |
@@ -278,3 +282,3 @@ void Gutenbrowser::initView() | |||
278 | Lview = new MultiLine_Ex(this); | 282 | Lview = new MultiLine_Ex(this); |
279 | 283 | ||
280 | Config cfg("Gutenbrowser"); | 284 | Config cfg("Gutenbrowser"); |
@@ -295,3 +299,3 @@ void Gutenbrowser::initView() | |||
295 | if(italic=="TRUE") { | 299 | if(italic=="TRUE") { |
296 | qDebug("Set Italic font"); | 300 | odebug << "Set Italic font" << oendl; |
297 | defaultFont = fdb.font(family,"Regular",i_size,charSet); //workaround | 301 | defaultFont = fdb.font(family,"Regular",i_size,charSet); //workaround |
diff --git a/noncore/apps/opie-gutenbrowser/helpme.cpp b/noncore/apps/opie-gutenbrowser/helpme.cpp index 6a9b8c0..53e0236 100644 --- a/noncore/apps/opie-gutenbrowser/helpme.cpp +++ b/noncore/apps/opie-gutenbrowser/helpme.cpp | |||
@@ -16,4 +16,2 @@ | |||
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | #include <qpe/qcopenvelope_qws.h> | ||
18 | #include <qpe/qpeapplication.h> | ||
19 | 17 | ||
@@ -22,2 +20,8 @@ | |||
22 | 20 | ||
21 | /* OPIE */ | ||
22 | #include <qpe/qcopenvelope_qws.h> | ||
23 | #include <qpe/qpeapplication.h> | ||
24 | #include <opie2/odebug.h> | ||
25 | |||
26 | /* QT */ | ||
23 | #include <qprogressdialog.h> | 27 | #include <qprogressdialog.h> |
@@ -25,2 +29,3 @@ | |||
25 | 29 | ||
30 | /* STD */ | ||
26 | #include <sys/stat.h> | 31 | #include <sys/stat.h> |
@@ -113,3 +118,3 @@ void HelpMe::help() | |||
113 | msg=QPEApplication::qpeDir()+"help/html/gutenbrowser-index.html"; // or where ever this ends up to be | 118 | msg=QPEApplication::qpeDir()+"help/html/gutenbrowser-index.html"; // or where ever this ends up to be |
114 | qDebug(msg); | 119 | odebug << msg << oendl; |
115 | QString url = "file://"+msg; | 120 | QString url = "file://"+msg; |
@@ -119,3 +124,3 @@ qDebug(msg); | |||
119 | // e << msg; | 124 | // e << msg; |
120 | 125 | ||
121 | // goGetit( msg); | 126 | // goGetit( msg); |
diff --git a/noncore/apps/opie-gutenbrowser/main.cpp b/noncore/apps/opie-gutenbrowser/main.cpp index 5c3348c..71c836d 100644 --- a/noncore/apps/opie-gutenbrowser/main.cpp +++ b/noncore/apps/opie-gutenbrowser/main.cpp | |||
@@ -39,3 +39,3 @@ OPIE_EXPORT_APP( OApplicationFactory<Gutenbrowser> ) | |||
39 | // // printf("Gutenbrowser: "VERSION"\n"); | 39 | // // printf("Gutenbrowser: "VERSION"\n"); |
40 | // // // qDebug("Gutenbrowser: "VERSION); | 40 | // // // odebug << "Gutenbrowser: "VERSION << oendl; |
41 | // // // return 0; | 41 | // // // return 0; |
diff --git a/noncore/apps/opie-gutenbrowser/openetext.cpp b/noncore/apps/opie-gutenbrowser/openetext.cpp index bd44ce6..0267416 100644 --- a/noncore/apps/opie-gutenbrowser/openetext.cpp +++ b/noncore/apps/opie-gutenbrowser/openetext.cpp | |||
@@ -20,2 +20,3 @@ | |||
20 | #include <opie2/ofiledialog.h> | 20 | #include <opie2/ofiledialog.h> |
21 | #include <opie2/odebug.h> | ||
21 | #include <qpe/applnk.h> | 22 | #include <qpe/applnk.h> |
@@ -25,3 +26,3 @@ using namespace Opie::Ui; | |||
25 | 26 | ||
26 | #include <stdlib.h> | 27 | /* QT */ |
27 | #include <qtextstream.h> | 28 | #include <qtextstream.h> |
@@ -29,2 +30,3 @@ using namespace Opie::Ui; | |||
29 | 30 | ||
31 | /* STD */ | ||
30 | #if defined(_WS_WIN_) | 32 | #if defined(_WS_WIN_) |
@@ -33,3 +35,4 @@ using namespace Opie::Ui; | |||
33 | #include <unistd.h> | 35 | #include <unistd.h> |
34 | #include "sys/stat.h" | 36 | #include <stdlib.h> |
37 | #include <sys/stat.h> | ||
35 | #endif | 38 | #endif |
@@ -136,3 +139,3 @@ OpenFileButton->setDown(TRUE); | |||
136 | 139 | ||
137 | qDebug("Open file: "+str); | 140 | odebug << "Open file: "+str << oendl; |
138 | 141 | ||
@@ -166,3 +169,3 @@ OpenFileButton->setDown(TRUE); | |||
166 | if( chdir((const char*)local_library.latin1())!=0) | 169 | if( chdir((const char*)local_library.latin1())!=0) |
167 | qDebug("chdir failed.");// QString cmd = "gunzip -d " + filer + " -d " + local_library; | 170 | odebug << "chdir failed." << oendl; // QString cmd = "gunzip -d " + filer + " -d " + local_library; |
168 | cmd = "gunzip -S .zip " + filer; | 171 | cmd = "gunzip -S .zip " + filer; |
@@ -173,3 +176,3 @@ OpenFileButton->setDown(TRUE); | |||
173 | else /*if( s_fileName.right(4) == ".txt" || if( s_fileName.right(4) == ".TXT"))*/ { | 176 | else /*if( s_fileName.right(4) == ".txt" || if( s_fileName.right(4) == ".TXT"))*/ { |
174 | // qDebug("Filename is "+fileName); | 177 | // odebug << "Filename is "+fileName << oendl; |
175 | s_fileName = fileName; | 178 | s_fileName = fileName; |
@@ -178,3 +181,3 @@ OpenFileButton->setDown(TRUE); | |||
178 | fileName = s_fileName; | 181 | fileName = s_fileName; |
179 | // qDebug("Filename is now "+fileName); | 182 | // odebug << "Filename is now "+fileName << oendl; |
180 | } | 183 | } |
@@ -189,7 +192,7 @@ OpenFileButton->setDown(TRUE); | |||
189 | 192 | ||
190 | qDebug("Setting doclink"); | 193 | odebug << "Setting doclink" << oendl; |
191 | DocLnk lnk; | 194 | DocLnk lnk; |
192 | qDebug("name is " + name_file); | 195 | odebug << "name is " + name_file << oendl; |
193 | lnk.setName(name_file); //sets file name | 196 | lnk.setName(name_file); //sets file name |
194 | qDebug("Title is "+title); | 197 | odebug << "Title is "+title << oendl; |
195 | lnk.setComment(title); | 198 | lnk.setComment(title); |
@@ -198,3 +201,3 @@ OpenFileButton->setDown(TRUE); | |||
198 | getTitles(); | 201 | getTitles(); |
199 | qDebug("Filename is "+fileName); | 202 | odebug << "Filename is "+fileName << oendl; |
200 | lnk.setFile(fileName); //sets File property | 203 | lnk.setFile(fileName); //sets File property |
@@ -204,3 +207,3 @@ OpenFileButton->setDown(TRUE); | |||
204 | if(!lnk.writeLink()) | 207 | if(!lnk.writeLink()) |
205 | qDebug("Writing doclink did not work"); | 208 | odebug << "Writing doclink did not work" << oendl; |
206 | 209 | ||
@@ -221,3 +224,3 @@ bool OpenEtext::FindTitle( QString filename) | |||
221 | name = fi.fileName(); | 224 | name = fi.fileName(); |
222 | qDebug("filename to open is " + name); | 225 | odebug << "filename to open is " + name << oendl; |
223 | QFile indexLib( filename); | 226 | QFile indexLib( filename); |
@@ -227,3 +230,3 @@ bool OpenEtext::FindTitle( QString filename) | |||
227 | if ( indexLib.open( IO_ReadOnly) ) { | 230 | if ( indexLib.open( IO_ReadOnly) ) { |
228 | qDebug("file opened successfully"); | 231 | odebug << "file opened successfully" << oendl; |
229 | QTextStream indexStream( &indexLib ); | 232 | QTextStream indexStream( &indexLib ); |
@@ -241,3 +244,3 @@ bool OpenEtext::FindTitle( QString filename) | |||
241 | title = title.stripWhiteSpace (); | 244 | title = title.stripWhiteSpace (); |
242 | // qDebug("Found the title 1 and it is %s", title.latin1()); | 245 | // odebug << "Found the title 1 and it is " << title << "" << oendl; |
243 | // QListBox_1->insertItem ( title); | 246 | // QListBox_1->insertItem ( title); |
@@ -249,3 +252,3 @@ bool OpenEtext::FindTitle( QString filename) | |||
249 | title = title.stripWhiteSpace (); | 252 | title = title.stripWhiteSpace (); |
250 | // qDebug("Found the title 2 and it is %s", title.latin1()); | 253 | // odebug << "Found the title 2 and it is " << title << "" << oendl; |
251 | // QListBox_1->insertItem ( title); | 254 | // QListBox_1->insertItem ( title); |
@@ -257,3 +260,3 @@ bool OpenEtext::FindTitle( QString filename) | |||
257 | title = title.stripWhiteSpace (); | 260 | title = title.stripWhiteSpace (); |
258 | // qDebug("Found the title 3 and it is %s", title.latin1()); | 261 | // odebug << "Found the title 3 and it is " << title << "" << oendl; |
259 | } | 262 | } |
@@ -264,3 +267,3 @@ bool OpenEtext::FindTitle( QString filename) | |||
264 | title = title.stripWhiteSpace (); | 267 | title = title.stripWhiteSpace (); |
265 | // qDebug("Found the title 4 and it is %s", title.latin1()); | 268 | // odebug << "Found the title 4 and it is " << title << "" << oendl; |
266 | } | 269 | } |
@@ -270,3 +273,3 @@ bool OpenEtext::FindTitle( QString filename) | |||
270 | if( !findCheck || title.length() < 2) { | 273 | if( !findCheck || title.length() < 2) { |
271 | qDebug("Trying hard to find title from GUTINDEX.ALL"); | 274 | odebug << "Trying hard to find title from GUTINDEX.ALL" << oendl; |
272 | title = titleFromLibrary( filename); | 275 | title = titleFromLibrary( filename); |
@@ -295,3 +298,3 @@ bool OpenEtext::FindTitle( QString filename) | |||
295 | if(title.length()<3) { | 298 | if(title.length()<3) { |
296 | // qDebug("title is empty"); | 299 | // odebug << "title is empty" << oendl; |
297 | title="Unknown"; | 300 | title="Unknown"; |
@@ -345,3 +348,3 @@ QString OpenEtext::titleFromLibrary( QString fileName) | |||
345 | title = title.stripWhiteSpace (); | 348 | title = title.stripWhiteSpace (); |
346 | // qDebug("Finally Found the title and it is\n %s", title.latin1()); | 349 | // odebug << "Finally Found the title and it is\n " << title << "" << oendl; |
347 | // QListBox_1->insertItem ( title); | 350 | // QListBox_1->insertItem ( title); |
@@ -351,3 +354,3 @@ QString OpenEtext::titleFromLibrary( QString fileName) | |||
351 | else | 354 | else |
352 | qDebug("Error opening library index "+ local_index); | 355 | odebug << "Error opening library index "+ local_index << oendl; |
353 | return title; | 356 | return title; |
@@ -416,3 +419,3 @@ void OpenEtext::removeSelection() | |||
416 | rem=i; | 419 | rem=i; |
417 | //qDebug("file title to remove is "+file_title); | 420 | //odebug << "file title to remove is "+file_title << oendl; |
418 | selFile = s_filename; | 421 | selFile = s_filename; |
@@ -484,3 +487,3 @@ void OpenEtext::editTitle() { | |||
484 | QString title_text = QListBox_1->text( currentItem); | 487 | QString title_text = QListBox_1->text( currentItem); |
485 | //qDebug("Selected "+title_text); | 488 | //odebug << "Selected "+title_text << oendl; |
486 | 489 | ||
@@ -498,6 +501,6 @@ void OpenEtext::editTitle() { | |||
498 | QString file_title = config.readEntry( s_filename, ""); | 501 | QString file_title = config.readEntry( s_filename, ""); |
499 | //qDebug("file_title is "+file_title); | 502 | //odebug << "file_title is "+file_title << oendl; |
500 | if(title_text == file_title ) { | 503 | if(title_text == file_title ) { |
501 | selFile = s_filename; | 504 | selFile = s_filename; |
502 | //qDebug("Edit: "+ file_title ); | 505 | //odebug << "Edit: "+ file_title << oendl; |
503 | i=i_numofFiles+1; | 506 | i=i_numofFiles+1; |
@@ -506,3 +509,3 @@ void OpenEtext::editTitle() { | |||
506 | if(titleEdit->exec() !=0) { | 509 | if(titleEdit->exec() !=0) { |
507 | //qDebug(titleEdit->newTitle); | 510 | //odebug << titleEdit->newTitle << oendl; |
508 | config.writeEntry( s_filename, titleEdit->newTitle); | 511 | config.writeEntry( s_filename, titleEdit->newTitle); |
diff --git a/noncore/apps/opie-gutenbrowser/optionsDialog.cpp b/noncore/apps/opie-gutenbrowser/optionsDialog.cpp index bfd9c26..8cc83da 100644 --- a/noncore/apps/opie-gutenbrowser/optionsDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/optionsDialog.cpp | |||
@@ -15,10 +15,6 @@ | |||
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | #include "optionsDialog.h" | ||
17 | #include <qpe/config.h> | ||
18 | #include "fontDialog.h" | ||
19 | 16 | ||
20 | // #include <unistd.h> | ||
21 | // #include <stdio.h> | ||
22 | // #include <stdlib.h> | ||
23 | 17 | ||
18 | #include "optionsDialog.h" | ||
19 | #include "fontDialog.h" | ||
24 | //#include "ftpsitedlg.h" | 20 | //#include "ftpsitedlg.h" |
@@ -26,2 +22,8 @@ | |||
26 | //#define Inherited QDialog | 22 | //#define Inherited QDialog |
23 | |||
24 | /* OPIE */ | ||
25 | #include <opie2/odebug.h> | ||
26 | #include <qpe/config.h> | ||
27 | |||
28 | /* QT */ | ||
27 | #include <qfont.h> | 29 | #include <qfont.h> |
@@ -40,2 +42,8 @@ | |||
40 | #endif | 42 | #endif |
43 | |||
44 | /* STD */ | ||
45 | // #include <unistd.h> | ||
46 | // #include <stdio.h> | ||
47 | // #include <stdlib.h> | ||
48 | |||
41 | /* | 49 | /* |
@@ -62,3 +70,3 @@ optionsDialog::~optionsDialog() | |||
62 | { | 70 | { |
63 | //qDebug("OnExit()"); | 71 | //odebug << "OnExit()" << oendl; |
64 | // writeConfig(); | 72 | // writeConfig(); |
@@ -127,3 +135,3 @@ void optionsDialog::getConfig() | |||
127 | cb_queryExit->setChecked(TRUE); | 135 | cb_queryExit->setChecked(TRUE); |
128 | qDebug("Config Setting b_qExit=TRUE;"); | 136 | odebug << "Config Setting b_qExit=TRUE;" << oendl; |
129 | b_qExit=TRUE; | 137 | b_qExit=TRUE; |
@@ -131,3 +139,3 @@ void optionsDialog::getConfig() | |||
131 | cb_queryExit->setChecked(FALSE); | 139 | cb_queryExit->setChecked(FALSE); |
132 | qDebug("ConfigSetting b_qExit=FALSE;"); | 140 | odebug << "ConfigSetting b_qExit=FALSE;" << oendl; |
133 | b_qExit=FALSE; | 141 | b_qExit=FALSE; |
@@ -135,3 +143,3 @@ void optionsDialog::getConfig() | |||
135 | 143 | ||
136 | 144 | ||
137 | useWordWrap_CheckBox->setChecked( config.readBoolEntry("WordWrap", 1)); | 145 | useWordWrap_CheckBox->setChecked( config.readBoolEntry("WordWrap", 1)); |
@@ -143,3 +151,3 @@ void optionsDialog::getConfig() | |||
143 | 151 | ||
144 | // // qDebug("Set style%d",index); | 152 | // // odebug << "Set style" << index << "" << oendl; |
145 | // // //int styleInt= index; | 153 | // // //int styleInt= index; |
@@ -169,3 +177,3 @@ void optionsDialog::slotQueryExit() | |||
169 | config.setGroup("General"); | 177 | config.setGroup("General"); |
170 | qDebug("writing queryExit"); | 178 | odebug << "writing queryExit" << oendl; |
171 | if(cb_queryExit->isChecked()) { | 179 | if(cb_queryExit->isChecked()) { |
@@ -173,3 +181,3 @@ void optionsDialog::slotQueryExit() | |||
173 | config.writeEntry("queryExit","TRUE"); | 181 | config.writeEntry("queryExit","TRUE"); |
174 | qDebug("WritingConfig queryExit=TRUE"); | 182 | odebug << "WritingConfig queryExit=TRUE" << oendl; |
175 | } else { | 183 | } else { |
@@ -177,3 +185,3 @@ void optionsDialog::slotQueryExit() | |||
177 | config.writeEntry("queryExit","FALSE"); | 185 | config.writeEntry("queryExit","FALSE"); |
178 | qDebug("WritingConfig queryExit=FALSE"); | 186 | odebug << "WritingConfig queryExit=FALSE" << oendl; |
179 | } | 187 | } |
@@ -189,6 +197,6 @@ void optionsDialog::slotQueryExit() | |||
189 | // void optionsDialog::lineEditChanged(const QString &editText) { | 197 | // void optionsDialog::lineEditChanged(const QString &editText) { |
190 | // qDebug(editText); | 198 | // odebug << editText << oendl; |
191 | // } | 199 | // } |
192 | 200 | ||
193 | void optionsDialog::changeFonts() | 201 | void optionsDialog::changeFonts() |
194 | { | 202 | { |
@@ -205,3 +213,3 @@ void optionsDialog::slotWordWrap(bool b) { | |||
205 | config.write(); | 213 | config.write(); |
206 | 214 | ||
207 | } | 215 | } |