summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-gutenbrowser/LibraryDialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialog.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
index 6c246e97..7f21ab3 100644
--- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
@@ -11,25 +11,25 @@
// * the Free Software Foundation; either version 2 of the License, or *
// * (at your option) any later version. *
// ***************************************************************************/
//ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL
#include "LibraryDialog.h"
#include "output.h"
/* OPIE */
#include <qpe/applnk.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpedialog.h>
-//#include <opie2///odebug.h>
+#include <opie2/odebug.h>
/* QT */
#include <qpushbutton.h>
#include <qmultilineedit.h>
//#include <qlayout.h>
/* STD */
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
/*
@@ -463,26 +463,30 @@ bool LibraryDialog::getEtext(const QStringList &networkList)
// use new, improved, *INSTANT* network-dialog-file-getterer
if( NetworkDlg->exec() != 0 ) {
File_Name = NetworkDlg->localFileName;
qDebug("Just downloaded " + NetworkDlg->localFileName);
if(NetworkDlg->successDownload) {
//odebug << "Filename is "+File_Name << oendl;
if(File_Name.right(4) == ".txt") {
QString s_fileName = File_Name;
s_fileName.replace( s_fileName.length() - 3, 3, "gtn");
- // s_fileName.replace( s_fileName.length()-3,3,"etx");
- rename( File_Name.latin1(), s_fileName.latin1());
+ if (rename( File_Name.latin1(), s_fileName.latin1()) == 1) {
+ owarn << "Failed to rename " << File_Name.latin1() << " to "
+ << s_fileName.latin1() << oendl;
+ return false;
+ }
+
File_Name = s_fileName;
//odebug << "Filename is now "+File_Name << oendl;
}
if(File_Name.length() > 5 ) {
setTitle();
QFileInfo fi(File_Name);
QString name_file = fi.fileName();
name_file = name_file.left( name_file.length() - 4);
//odebug << "Setting doclink" << oendl;
@@ -490,25 +494,24 @@ bool LibraryDialog::getEtext(const QStringList &networkList)
//odebug << "name is "+name_file << oendl;
lnk.setName(name_file); //sets file name
//odebug << "Title is "+DlglistItemTitle << oendl;
lnk.setComment(DlglistItemTitle);
//odebug << "Filename is "+File_Name << oendl;
lnk.setFile(File_Name); //sets File property
lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D
lnk.setExec(File_Name);
lnk.setIcon("gutenbrowser/Gutenbrowser");
if(!lnk.writeLink()) {
//odebug << "Writing doclink did not work" << oendl;
- } else {
}
} else
QMessageBox::message("Note","<p>There was an error with the file</p>");
}
}
return true;
}
bool LibraryDialog::download_Etext()
{ // ftp method
// might have to use old gpl'd ftp for embedded!!
@@ -692,25 +695,24 @@ void LibraryDialog::onButtonSearch()
SearchDialog* searchDlg;
// if( resultsList)
searchDlg = new SearchDialog( this, "Library Search", true);
searchDlg->setCaption( tr( "Library Search" ) );
searchDlg->setLabel( "- author or title");
QString resultString;
int i_berger = 0;
if( searchDlg->exec() != 0 ) {
QString searcherStr = searchDlg->get_text();
- int fluff = 0;
bool cS;
if( searchDlg->caseSensitiveCheckBox->isChecked())
cS = true; //case sensitive
else
cS = false;
etext etextStruct;
QValueList<etext>::Iterator it;
for( it = etextLibrary.begin(); it != etextLibrary.end(); ++it ) {
QString tempTitle = (*it).title;