summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-gutenbrowser/openetext.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-gutenbrowser/openetext.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/openetext.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/noncore/apps/opie-gutenbrowser/openetext.cpp b/noncore/apps/opie-gutenbrowser/openetext.cpp
index 40f35d6..bd44ce6 100644
--- a/noncore/apps/opie-gutenbrowser/openetext.cpp
+++ b/noncore/apps/opie-gutenbrowser/openetext.cpp
@@ -13,21 +13,22 @@
***************************************************************************/
#include "gutenbrowser.h"
#include "openetext.h"
#include "editTitle.h"
-#include <qfileinfo.h>
+/* OPIE */
+#include <opie2/ofiledialog.h>
#include <qpe/applnk.h>
+#include <qpe/config.h>
#include <qpe/qpeapplication.h>
+using namespace Opie::Ui;
#include <stdlib.h>
#include <qtextstream.h>
-#include <qpe/config.h>
-
-#include <opie/ofiledialog.h>
+#include <qfileinfo.h>
#if defined(_WS_WIN_)
#include <windows.h>
#else
#include <unistd.h>
#include "sys/stat.h"
@@ -146,19 +147,19 @@ OpenFileButton->setDown(TRUE);
// } else { //filename is empty
// // QString sMsg;
// // sMsg = "Error opening library filelist "+fileName;
// }
if( filer.right(4) == ".txt"
- || filer.right(4) == ".TXT"
- || filer.right(4) == ".etx"
- || filer.right(4) == ".ETX"
- || filer.right(4) == ".etx"
- || filer.right(4) == ".ETX"
- || filer.right(4) == ".zip"
- || filer.right(4) == ".ZIP" ) {
+ || filer.right(4) == ".TXT"
+ || filer.right(4) == ".etx"
+ || filer.right(4) == ".ETX"
+ || filer.right(4) == ".etx"
+ || filer.right(4) == ".ETX"
+ || filer.right(4) == ".zip"
+ || filer.right(4) == ".ZIP" ) {
QFileInfo zipFile( filer);
QString s_fileName = zipFile.fileName();
QString cmd;
if( s_fileName.right(4) == ".zip") { // unzip that sucker....
s_fileName = s_fileName.left( s_fileName.length() - 4);
@@ -175,16 +176,16 @@ OpenFileButton->setDown(TRUE);
s_fileName.replace( s_fileName.length()-3,3,"gtn");// s_fileName.replace( s_fileName.length()-3,3,"etx");
rename(fileName.latin1(),s_fileName.latin1());
fileName = s_fileName;
// qDebug("Filename is now "+fileName);
}
} else
- fileName = str;
-
+ fileName = str;
+
FindTitle(fileName);
-
+
QFileInfo fi( fileName);
name_file = fi.fileName();
name_file = name_file.left(name_file.length() - 4);
qDebug("Setting doclink");
DocLnk lnk;
@@ -221,13 +222,13 @@ bool OpenEtext::FindTitle( QString filename)
qDebug("filename to open is " + name);
QFile indexLib( filename);
bool findCheck = FALSE;
// int Titlenumber=0;
if ( indexLib.open( IO_ReadOnly) ) {
- qDebug("file opened successfully");
+ qDebug("file opened successfully");
QTextStream indexStream( &indexLib );
QString target = "Project Gutenberg Etext of";
QString target2 = "Project Gutenberg Etext";
QString target3 = "Project Gutenberg's Etext of";
QString target4 = "Project Gutenberg's Etext";
QString indexLine;
@@ -261,14 +262,14 @@ bool OpenEtext::FindTitle( QString filename)
title = indexLine.mid( indexLine.find( target4, 0, TRUE) + ( target4.length()) , indexLine.find("\r", 0, TRUE));
title = title.left( title.find( "*",0, TRUE));
title = title.stripWhiteSpace ();
// qDebug("Found the title 4 and it is %s", title.latin1());
}
} //endof file
- indexLib.close();
-
+ indexLib.close();
+
if( !findCheck || title.length() < 2) {
qDebug("Trying hard to find title from GUTINDEX.ALL");
title = titleFromLibrary( filename);
findCheck = TRUE;
}