summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-gutenbrowser/openetext.cpp
authorar <ar>2004-05-03 21:35:18 (UTC)
committer ar <ar>2004-05-03 21:35:18 (UTC)
commit412619441fab46fc79c695a23ccf9e38135bdfad (patch) (unidiff)
tree19d9b8af14cf6c345ef532bb32368b9c7b43c50f /noncore/apps/opie-gutenbrowser/openetext.cpp
parentd1095d71394779557f446e2a67ba55bc62eec859 (diff)
downloadopie-412619441fab46fc79c695a23ccf9e38135bdfad.zip
opie-412619441fab46fc79c695a23ccf9e38135bdfad.tar.gz
opie-412619441fab46fc79c695a23ccf9e38135bdfad.tar.bz2
- convert qDebug to odebug
Diffstat (limited to 'noncore/apps/opie-gutenbrowser/openetext.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/openetext.cpp55
1 files changed, 29 insertions, 26 deletions
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
@@ -18,20 +18,23 @@
18 18
19/* OPIE */ 19/* OPIE */
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>
22#include <qpe/config.h> 23#include <qpe/config.h>
23#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
24using namespace Opie::Ui; 25using namespace Opie::Ui;
25 26
26#include <stdlib.h> 27/* QT */
27#include <qtextstream.h> 28#include <qtextstream.h>
28#include <qfileinfo.h> 29#include <qfileinfo.h>
29 30
31/* STD */
30#if defined(_WS_WIN_) 32#if defined(_WS_WIN_)
31#include <windows.h> 33#include <windows.h>
32#else 34#else
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
36 39
37OpenEtext::OpenEtext(QWidget *parent, QString name) : QDialog(parent,name,true) 40OpenEtext::OpenEtext(QWidget *parent, QString name) : QDialog(parent,name,true)
@@ -134,7 +137,7 @@ OpenFileButton->setDown(TRUE);
134 if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) { 137 if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) {
135 filer = str; 138 filer = str;
136 139
137 qDebug("Open file: "+str); 140 odebug << "Open file: "+str << oendl;
138 141
139 // QStringList::ConstIterator f; 142 // QStringList::ConstIterator f;
140// QString fileTemp; 143// QString fileTemp;
@@ -164,19 +167,19 @@ OpenFileButton->setDown(TRUE);
164 if( s_fileName.right(4) == ".zip") { // unzip that sucker.... 167 if( s_fileName.right(4) == ".zip") { // unzip that sucker....
165 s_fileName = s_fileName.left( s_fileName.length() - 4); 168 s_fileName = s_fileName.left( s_fileName.length() - 4);
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;
169 fileName = local_library + s_fileName + ".txt"; 172 fileName = local_library + s_fileName + ".txt";
170 system( cmd); 173 system( cmd);
171 } 174 }
172// this renames the .txt to .etx!! 175// this renames the .txt to .etx!!
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;
176 s_fileName.replace( s_fileName.length()-3,3,"gtn");// s_fileName.replace( s_fileName.length()-3,3,"etx"); 179 s_fileName.replace( s_fileName.length()-3,3,"gtn");// s_fileName.replace( s_fileName.length()-3,3,"etx");
177 rename(fileName.latin1(),s_fileName.latin1()); 180 rename(fileName.latin1(),s_fileName.latin1());
178 fileName = s_fileName; 181 fileName = s_fileName;
179// qDebug("Filename is now "+fileName); 182// odebug << "Filename is now "+fileName << oendl;
180 } 183 }
181 } else 184 } else
182 fileName = str; 185 fileName = str;
@@ -187,22 +190,22 @@ OpenFileButton->setDown(TRUE);
187 name_file = fi.fileName(); 190 name_file = fi.fileName();
188 name_file = name_file.left(name_file.length() - 4); 191 name_file = name_file.left(name_file.length() - 4);
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);
196 199
197 QListBox_1->clear(); 200 QListBox_1->clear();
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
201 lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D 204 lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D
202 lnk.setExec(fileName); 205 lnk.setExec(fileName);
203 lnk.setIcon("gutenbrowser/Gutenbrowser"); 206 lnk.setIcon("gutenbrowser/Gutenbrowser");
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
207 } // end of for each file name.... 210 } // end of for each file name....
208 OpenFileButton->setDown(FALSE); 211 OpenFileButton->setDown(FALSE);
@@ -219,13 +222,13 @@ bool OpenEtext::FindTitle( QString filename)
219 222
220 QFileInfo fi(filename); 223 QFileInfo fi(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);
224 bool findCheck = FALSE; 227 bool findCheck = FALSE;
225 // int Titlenumber=0; 228 // int Titlenumber=0;
226 229
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 );
230 QString target = "Project Gutenberg Etext of"; 233 QString target = "Project Gutenberg Etext of";
231 QString target2 = "Project Gutenberg Etext"; 234 QString target2 = "Project Gutenberg Etext";
@@ -239,7 +242,7 @@ bool OpenEtext::FindTitle( QString filename)
239 title = indexLine.mid( indexLine.find(target, 0, TRUE) + (target.length()) , indexLine.find("\r", 0, TRUE)); 242 title = indexLine.mid( indexLine.find(target, 0, TRUE) + (target.length()) , indexLine.find("\r", 0, TRUE));
240 title = title.left( title.find( "*",0, TRUE)); 243 title = title.left( title.find( "*",0, TRUE));
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);
244 } 247 }
245 if( indexLine.find( target2, 0, TRUE) > -1 && !findCheck) { 248 if( indexLine.find( target2, 0, TRUE) > -1 && !findCheck) {
@@ -247,7 +250,7 @@ bool OpenEtext::FindTitle( QString filename)
247 title = indexLine.mid( indexLine.find( target2, 0, TRUE ) + ( target2.length()) , indexLine.find("\r", 0, TRUE) ); 250 title = indexLine.mid( indexLine.find( target2, 0, TRUE ) + ( target2.length()) , indexLine.find("\r", 0, TRUE) );
248 title = title.left( title.find( "*",0, TRUE)); 251 title = title.left( title.find( "*",0, TRUE));
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);
252 } 255 }
253 if( indexLine.find( target3, 0, TRUE) > -1 && !findCheck) { 256 if( indexLine.find( target3, 0, TRUE) > -1 && !findCheck) {
@@ -255,20 +258,20 @@ bool OpenEtext::FindTitle( QString filename)
255 title = indexLine.mid( indexLine.find( target3, 0, TRUE) + ( target3.length()) , indexLine.find("\r", 0, TRUE)); 258 title = indexLine.mid( indexLine.find( target3, 0, TRUE) + ( target3.length()) , indexLine.find("\r", 0, TRUE));
256 title = title.left( title.find( "*",0, TRUE)); 259 title = title.left( title.find( "*",0, TRUE));
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 }
260 if( indexLine.find( target4, 0, TRUE) > -1 && !findCheck) { 263 if( indexLine.find( target4, 0, TRUE) > -1 && !findCheck) {
261 findCheck = TRUE; 264 findCheck = TRUE;
262 title = indexLine.mid( indexLine.find( target4, 0, TRUE) + ( target4.length()) , indexLine.find("\r", 0, TRUE)); 265 title = indexLine.mid( indexLine.find( target4, 0, TRUE) + ( target4.length()) , indexLine.find("\r", 0, TRUE));
263 title = title.left( title.find( "*",0, TRUE)); 266 title = title.left( title.find( "*",0, TRUE));
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 }
267 } //endof file 270 } //endof file
268 indexLib.close(); 271 indexLib.close();
269 272
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);
273 findCheck = TRUE; 276 findCheck = TRUE;
274 } 277 }
@@ -293,7 +296,7 @@ bool OpenEtext::FindTitle( QString filename)
293 i= i_numofFiles+1; 296 i= i_numofFiles+1;
294 } 297 }
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";
298 } 301 }
299 config.writeEntry( filename,title); 302 config.writeEntry( filename,title);
@@ -343,13 +346,13 @@ QString OpenEtext::titleFromLibrary( QString fileName)
343 title = indexLine.mid( 9, 50); 346 title = indexLine.mid( 9, 50);
344// title = indexLine.mid( 26, indexLine.length() ); 347// title = indexLine.mid( 26, indexLine.length() );
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);
348 } 351 }
349 } //end while loop 352 } //end while loop
350 } 353 }
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;
354} 357}
355 358
@@ -414,7 +417,7 @@ void OpenEtext::removeSelection()
414 QString file_title = config.readEntry( s_filename, ""); 417 QString file_title = config.readEntry( s_filename, "");
415 if(title_text == file_title) { 418 if(title_text == file_title) {
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;
419 config.removeEntry( s_filename); //removes file=title 422 config.removeEntry( s_filename); //removes file=title
420 } 423 }
@@ -482,7 +485,7 @@ void OpenEtext::editTitle() {
482 485
483 int currentItem=QListBox_1->currentItem(); 486 int currentItem=QListBox_1->currentItem();
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
487 Config config("Gutenbrowser"); 490 Config config("Gutenbrowser");
488 config.setGroup( "Files" ); 491 config.setGroup( "Files" );
@@ -496,15 +499,15 @@ void OpenEtext::editTitle() {
496 QString s_filename = config.readEntry(fileNum, "" ); 499 QString s_filename = config.readEntry(fileNum, "" );
497 config.setGroup( "Titles" ); 500 config.setGroup( "Titles" );
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;
504 Edit_Title *titleEdit; 507 Edit_Title *titleEdit;
505 titleEdit = new Edit_Title(this,file_title ,TRUE); 508 titleEdit = new Edit_Title(this,file_title ,TRUE);
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);
509 QListBox_1->removeItem(currentItem); 512 QListBox_1->removeItem(currentItem);
510 QListBox_1->insertItem ( QPixmap( QPEApplication::qpeDir()+"pics/gutenbrowser/gutenbrowser_sm.png"), titleEdit->newTitle, currentItem); 513 QListBox_1->insertItem ( QPixmap( QPEApplication::qpeDir()+"pics/gutenbrowser/gutenbrowser_sm.png"), titleEdit->newTitle, currentItem);