summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-gutenbrowser/NetworkDialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/NetworkDialog.cpp50
1 files changed, 28 insertions, 22 deletions
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
@@ -7,32 +7,38 @@
// * it under the terms of the GNU General Public License as published by *
// * the Free Software Foundation; either version 2 of the License, or *
// * (at your option) any later version. *
// ***************************************************************************/
// // half-assed attempt at providing a network dialog.
// /* Created: Sun Aug 27 15:24:52 2000*/
-#include <unistd.h>
-extern "C" {
-#include <ftplib.h>
-}
#include "NetworkDialog.h"
#include "gutenbrowser.h"
+/* OPIE */
+#include <opie2/odebug.h>
+
+/* QT */
#include <qprogressbar.h>
#include <qstringlist.h>
#include <qpe/config.h>
#include <qvaluelist.h>
#include <qapplication.h>
#include <qfile.h>
#include <qstringlist.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
+/* STD */
+#include <unistd.h>
+extern "C" {
+#include <ftplib.h>
+}
+
QProgressBar* ProgressBar1;
QPushButton* buttonCancel;
static netbuf *conn = NULL;
static int log_progress(netbuf *ctl, int xfered, void *arg) {
int fsz = *(int *)arg;
@@ -116,13 +122,13 @@ void NetworkDialog::initDialog() {
connect(buttonOk,SIGNAL(clicked()),this,SLOT(doOk()));
connect(buttonCancel,SIGNAL(clicked()),this,SLOT(reject()));
// connect( timer, SIGNAL(timeout()), this , SLOT(timeSlot()));
// connect( connectionTimer,SIGNAL( timeout()),this,SLOT( connectionTimeSlot()));
if(autoOk) {
- qWarning("XXXXXXXXXXXXXXXXXXXXXXXX");
+ owarn << "XXXXXXXXXXXXXXXXXXXXXXXX" << oendl;
buttonOk->setDown(true);
doOk();
}
}
void NetworkDialog::timeSlot() {
@@ -140,19 +146,19 @@ void NetworkDialog::timeSlot() {
// timerProgess--;
// } else if(timerProgess > 1 &&!posTimer){
// ProgressBar1->setProgress(timerProgess);
// timerProgess--;
// posTimer=TRUE;
// }
-// // qDebug("timer event");
+// // odebug << "timer event" << oendl;
// qApp->processEvents();
// repaint();
}
void NetworkDialog::connectionTimeSlot() {
-// qDebug("Connections timed out");
+// odebug << "Connections timed out" << oendl;
// ftpQuit();
// qApp->processEvents();
// repaint();
// reject();
}
@@ -164,27 +170,27 @@ bool NetworkDialog::downloadFile( QString networkUrl )
int fsz;
// timer->start( 250 , FALSE);
// posTimer=TRUE;
// connectionTimer->start( 600 , FALSE);
warnLabel ->setText( "");
qApp->processEvents();
- qDebug("Downloading: %s",networkUrl.latin1());
- qDebug("Into: %s",localFileName.latin1());
+ odebug << "Downloading: " << networkUrl << "" << oendl;
+ odebug << "Into: " << localFileName << "" << oendl;
if( networkUrl.length() > 5) {
QString ftp_user = "anonymous";
QString ftp_pass = "zaurus@gutenbrowser.com";
// ftp_host= networkUrl.mid(networkUrl.find("ftp://",0, TRUE),
if(ftp_host.length() < 2) {
- qDebug("Please select an ftp host" );
+ odebug << "Please select an ftp host" << oendl;
successDownload=false;
QMessageBox::message("Note","You need to select an ftp host");
return false;
}
QString msg;
- qDebug(ftp_host);
- qDebug("Opening ftp connection.");
+ odebug << ftp_host << oendl;
+ odebug << "Opening ftp connection." << oendl;
warnLabel->setText("connecting to: "+ftp_host );
qApp->processEvents();
/////////// Open FTP connection
if (!FtpConnect( ftp_host.latin1(), &conn)) {
i=0;
successDownload=false;
@@ -197,13 +203,13 @@ bool NetworkDialog::downloadFile( QString networkUrl )
FtpQuit(conn);
successDownload=false;
msg.sprintf("Unable to log in\n%s",FtpLastResponse(conn));
QMessageBox::message("Note",msg);
return false;
}
- qDebug("Changing directories.");
+ odebug << "Changing directories." << oendl;
TextLabel3->setText("Changing directories.");
qApp->processEvents();
if (!FtpChdir( dir.latin1(), conn )) {
successDownload=false;
msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn));
QMessageBox::message("Note",msg);
@@ -214,13 +220,13 @@ bool NetworkDialog::downloadFile( QString networkUrl )
// successDownload=false;
// msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn));
// QMessageBox::message("Note",msg);
// FtpQuit(conn);
// return false;
// }
- qDebug("Requesting directory list.");
+ odebug << "Requesting directory list." << oendl;
TextLabel3->setText("Getting directory list.");
qApp->processEvents();
if (!FtpDir( "./.guten_temp", dir.latin1(), conn) ) {
msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn));
QMessageBox::message("Note",msg);
successDownload=false;
@@ -229,45 +235,45 @@ bool NetworkDialog::downloadFile( QString networkUrl )
}
QFile tmp("./.guten_temp");
QString s, File_Name;
if (tmp.open(IO_ReadOnly)) {
QTextStream t( &tmp ); // use a text stream
- qDebug("Finding partial filename "+s_partialFileName);
+ odebug << "Finding partial filename "+s_partialFileName << oendl;
while ( !t.eof()) {
s = t.readLine();
if (s.contains(s_partialFileName, FALSE)) {
QString str = s.right( (s.length()) - (s.find(s_partialFileName, FALSE)) );
if (str.contains(".txt")) {
File_Name = str;
- qDebug("Found file_name "+ File_Name);
+ odebug << "Found file_name "+ File_Name << oendl;
break;
}
// if (str.contains(".zip")) {
// File_Name = str;
-// qDebug("Found file_name "+ File_Name);
+// odebug << "Found file_name "+ File_Name << oendl;
// break;
// }
}
} //end of while loop
tmp.close();
// tmp.remove(); ///TODO this is for release version Zaurus
}
else
- qDebug("Error opening temp file.");
+ odebug << "Error opening temp file." << oendl;
Config cfg("Gutenbrowser");
cfg.setGroup("General");
QString temp=cfg.readEntry("DownloadDirectory",local_library);
localFileName = temp+File_Name;
- qDebug("Requesting file "+ File_Name);
- qDebug( "Saving as "+localFileName);
+ odebug << "Requesting file "+ File_Name << oendl;
+ odebug << "Saving as "+localFileName << oendl;
msg="Requesting file "+ File_Name;
TextLabel3->setText(msg);
qApp->processEvents();
if( File_Name.length()>3) {
if (!FtpSize( File_Name.latin1(), &fsz, FTPLIB_ASCII, conn))
fsz = 0;
@@ -290,22 +296,22 @@ bool NetworkDialog::downloadFile( QString networkUrl )
} else {
QMessageBox::message("Note","Could not download file "+ File_Name);
successDownload=false;
FtpQuit(conn);
return false;
}
- qDebug("Ftp session successful");
+ odebug << "Ftp session successful" << oendl;
successDownload=TRUE;
FtpQuit(conn);
return true;
} //no network url
return false;
}
void NetworkDialog::doOk() {
- qWarning("Do OK");
+ owarn << "Do OK" << oendl;
QString loginStr;
loginStr = "gutenbrowser";
if ( !ftp_host.isEmpty() ) {
if( ftp_host.find( "/", ftp_host.length() - 1,TRUE) != -1 && ftp_host.find("ftp://",0, TRUE) != -1) {
TextLabel3->setText( tr( "List remote dir:\n" + ftp_host) );
// TextLabel2->setText( tr( "local file to download into: " +localFileName ) );