From 6712b04f22aa55717c32676be04bc2e0df40645b Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Sat, 5 Mar 2011 22:47:51 +0100 Subject: more random things... --- src/DownloadManager.cpp | 9 +++++---- src/fbbrowser.cpp | 3 --- src/fbgui.cpp | 4 ---- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/DownloadManager.cpp b/src/DownloadManager.cpp index 33c8952..d010490 100644 --- a/src/DownloadManager.cpp +++ b/src/DownloadManager.cpp @@ -35,10 +35,9 @@ void DownloadManager::startNextDownload() } // Dequeue next URL to download. QUrl url = dlQ.dequeue(); - QString tmp = url.path(); // Get filename from URL. - tmp.remove(0, tmp.lastIndexOf(QChar('/')) + 1); - outfile.setFileName(tmp); + QString tmp = url.path(); + outfile.setFileName(tmp.remove(0, tmp.lastIndexOf(QChar('/')) + 1)); // If error upon opening, skip this file. if (!outfile.open(QIODevice::WriteOnly)) @@ -50,6 +49,7 @@ void DownloadManager::startNextDownload() // Start the request for this URL. QNetworkRequest request(url); currentDownload = qnam->get(request); + // TODO: Error handling not working properly... if (currentDownload->error() != QNetworkReply::NoError) { qDebug() << "Network reply error, skipping download..."; @@ -88,7 +88,8 @@ void DownloadManager::downloadFinished() { // Second check if the download actually is finished. if (currentDownload->isFinished()) - qDebug() << "Downloaded " << currentDownload->url().toString() << endl; + qDebug() << "Download of " << currentDownload->url().toString() + << "finished." << endl; // Close output file. outfile.close(); currentDownload->deleteLater(); diff --git a/src/fbbrowser.cpp b/src/fbbrowser.cpp index 6528cc8..160b9c5 100644 --- a/src/fbbrowser.cpp +++ b/src/fbbrowser.cpp @@ -23,9 +23,6 @@ fbbrowser::fbbrowser(const QUrl & url) // Let the manager send the request and receive the reply. reply = manager->get(request); // TODO: error differentiation - // reply->error() returns 0 even for invalid URL. - // A possibility to check for validity, is to listen to readyRead() - // signal, haven't found a better way yet ... if(reply->error() == QNetworkReply::NoError) { view->load(url); diff --git a/src/fbgui.cpp b/src/fbgui.cpp index 1851ad4..57df27b 100644 --- a/src/fbgui.cpp +++ b/src/fbgui.cpp @@ -45,10 +45,6 @@ int main(int argc, char *argv[]) { qDebug() << "Help requested. Printing usage info. Exiting..."; printUsage(); - // Not quite sure what the best exit statement is. - // Maybe better a.quit() ? - //exit(0); - // Probably use the EXIT_SUCCESS / EXIT_FAILURE constants as defined in "man exit" return EXIT_SUCCESS; } -- cgit v1.2.3-55-g7522