diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-04-30 01:26:39 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-04-30 01:26:39 +0200 |
commit | 97cd6ce8851e19ddce3d0bf098a8b8a00ee02992 (patch) | |
tree | 3f250058b6792ca4fc275d8d8e6a2d8e282c4f8a /src | |
parent | Fixed wrong pointed out text in the Browse ListItem (diff) | |
download | rekonq-97cd6ce8851e19ddce3d0bf098a8b8a00ee02992.tar.xz |
Fix (again and again) ftp handling (and errors in general)
Disabled the "Failed to Load" string as rekonq usually does a lot more than
WebKit to "load" an url..
Diffstat (limited to 'src')
-rw-r--r-- | src/mainview.cpp | 4 | ||||
-rw-r--r-- | src/protocolhandler.cpp | 42 | ||||
-rw-r--r-- | src/protocolhandler.h | 2 | ||||
-rw-r--r-- | src/webpage.cpp | 15 | ||||
-rw-r--r-- | src/webpage.h | 4 |
5 files changed, 37 insertions, 30 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index fa834af6..21ee08d6 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -568,8 +568,8 @@ void MainView::webViewLoadFinished(bool ok) if (ok) emit showStatusBarMessage(i18n("Done"), Rekonq::Success); - else - emit showStatusBarMessage(i18n("Failed to load"), Rekonq::Error); +// else +// emit showStatusBarMessage(i18n("Failed to load"), Rekonq::Error); } diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp index 1ee026a8..077807cb 100644 --- a/src/protocolhandler.cpp +++ b/src/protocolhandler.cpp @@ -205,6 +205,27 @@ bool ProtocolHandler::postHandling(const QNetworkRequest &request, QWebFrame *fr } +// --------------------------------------------------------------------------------------------------------------------------- + + +void ProtocolHandler::showResults(const KFileItemList &list) +{ + if(!_lister->rootItem().isNull() && _lister->rootItem().isReadable() && _lister->rootItem().isFile()) + { + emit downloadUrl( _lister->rootItem().url() ); + return; + } + + QString html = dirHandling(list); + _frame->setHtml( html, _url ); + + Application::instance()->mainWindow()->currentTab()->setFocus(); + Application::historyManager()->addHistoryEntry( _url.prettyUrl() ); + + delete _lister; +} + + QString ProtocolHandler::dirHandling(const KFileItemList &list) { if (!_lister) @@ -278,25 +299,6 @@ QString ProtocolHandler::dirHandling(const KFileItemList &list) } -void ProtocolHandler::showResults(const KFileItemList &list) -{ - if(!_lister->rootItem().isNull() && _lister->rootItem().isReadable() && _lister->rootItem().isFile()) - { - WebPage *page = qobject_cast<WebPage *>( _frame->page() ); - page->downloadUrl( _lister->rootItem().url() ); - return; - } - - QString html = dirHandling(list); - _frame->setHtml( html, _url ); - - Application::instance()->mainWindow()->currentTab()->setFocus(); - Application::historyManager()->addHistoryEntry( _url.prettyUrl() ); - - delete _lister; -} - - void ProtocolHandler::slotMostLocalUrlResult(KJob *job) { if(job->error()) @@ -315,7 +317,9 @@ void ProtocolHandler::slotMostLocalUrlResult(KJob *job) _lister->openUrl(_url); } else + { emit downloadUrl(_url); + } } } diff --git a/src/protocolhandler.h b/src/protocolhandler.h index 99aec70a..f96b5735 100644 --- a/src/protocolhandler.h +++ b/src/protocolhandler.h @@ -66,7 +66,7 @@ public: bool postHandling(const QNetworkRequest &request, QWebFrame *frame); signals: - void downloadUrl( const KUrl &); + void downloadUrl(const KUrl &); private slots: void showResults(const KFileItemList &); diff --git a/src/webpage.cpp b/src/webpage.cpp index efec20cf..1c9910e2 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -237,6 +237,11 @@ WebPage *WebPage::createWindow(QWebPage::WebWindowType type) void WebPage::handleUnsupportedContent(QNetworkReply *reply) { + // NOTE + // This is probably needed just in ONE stupid case.. + if( _protHandler.postHandling(reply->request(), mainFrame()) ) + return; + if (reply->error() == QNetworkReply::NoError) { const KUrl url( reply->url() ); @@ -358,14 +363,14 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply) } break; - case QNetworkReply::UnknownNetworkError: // unknown network-related error detected - if( _protHandler.postHandling(reply->request(), mainFrame()) ) - break; - case QNetworkReply::ContentAccessDenied: // access to remote content denied (similar to HTTP error 401) kDebug() << "We (hopefully) are managing this through the adblock :)"; break; - + + case QNetworkReply::UnknownNetworkError: // unknown network-related error detected + if( _protHandler.postHandling(reply->request(), mainFrame()) ) + break; + case QNetworkReply::ConnectionRefusedError: // remote server refused connection case QNetworkReply::HostNotFoundError: // invalid hostname case QNetworkReply::TimeoutError: // connection time out diff --git a/src/webpage.h b/src/webpage.h index 7c1ac2a5..cd86813c 100644 --- a/src/webpage.h +++ b/src/webpage.h @@ -69,10 +69,8 @@ protected: const QNetworkRequest &request, NavigationType type); -protected Q_SLOTS: - virtual void handleUnsupportedContent(QNetworkReply *reply); - private slots: + void handleUnsupportedContent(QNetworkReply *reply); void manageNetworkErrors(QNetworkReply *reply); void loadFinished(bool); void showSSLInfo(); |