summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-02-16 02:12:45 +0100
committerAndrea Diamantini <adjam7@gmail.com>2010-02-16 02:12:45 +0100
commitf364b998624e403a33dd1b79983f80b2d058da26 (patch)
tree9ff074a6108d42e82c826f0d2f7ecb5ac6fc1df9 /src
parentrekonq 0.3.92 (diff)
downloadrekonq-f364b998624e403a33dd1b79983f80b2d058da26.tar.xz
Fixes focus && let Protocol handler to just load on demand
the KDirLister class (and delete on finish)
Diffstat (limited to 'src')
-rw-r--r--src/mainview.cpp4
-rw-r--r--src/protocolhandler.cpp22
-rw-r--r--src/urlbar/urlbar.cpp14
-rw-r--r--src/webpage.cpp1
4 files changed, 25 insertions, 16 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 8034563b..cf79ad9e 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -501,7 +501,7 @@ void MainView::closeTab(int index)
}
hasFocus = tab->hasFocus();
- //store close tab except homepage
+ // store close tab except homepage
if (!tab->url().prettyUrl().startsWith( QLatin1String("about:") ) && !tab->url().isEmpty())
{
QString title = tab->view()->title();
@@ -513,7 +513,7 @@ void MainView::closeTab(int index)
removeTab(index);
updateTabBar(); // UI operation: do it ASAP!!
- tab->deleteLater(); // webView is scheduled for deletion.
+ tab->deleteLater(); // tab is scheduled for deletion.
emit tabsChanged();
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp
index 995c1448..af2e9904 100644
--- a/src/protocolhandler.cpp
+++ b/src/protocolhandler.cpp
@@ -36,6 +36,7 @@
#include "mainwindow.h"
#include "mainview.h"
#include "urlbar.h"
+#include "webtab.h"
#include "historymanager.h"
// KDE Includes
@@ -63,10 +64,9 @@
ProtocolHandler::ProtocolHandler(QObject *parent)
: QObject(parent)
- , _lister(new KDirLister)
+ , _lister(0)
, _frame(0)
{
- connect( _lister, SIGNAL(newItems(const KFileItemList &)), this, SLOT(showResults(const KFileItemList &)));
}
@@ -154,8 +154,10 @@ bool ProtocolHandler::postHandling(const QNetworkRequest &request, QWebFrame *fr
QFileInfo fileInfo( _url.path() );
if(fileInfo.isDir())
{
+ _lister = new KDirLister;
+ connect( _lister, SIGNAL(newItems(const KFileItemList &)), this, SLOT(showResults(const KFileItemList &)));
_lister->openUrl(_url);
- Application::instance()->mainWindow()->mainView()->urlBar()->setUrl(_url);
+
return true;
}
}
@@ -166,6 +168,10 @@ bool ProtocolHandler::postHandling(const QNetworkRequest &request, QWebFrame *fr
QString ProtocolHandler::dirHandling(const KFileItemList &list)
{
+ if (!_lister)
+ {
+ return QString("rekonq error, sorry :(");
+ }
KFileItem mainItem = _lister->rootItem();
KUrl rootUrl = mainItem.url();
@@ -254,14 +260,14 @@ void ProtocolHandler::showResults(const KFileItemList &list)
return;
}
- if ( list.isEmpty() )
- return;
-
QString html = dirHandling(list);
_frame->setHtml(html);
+ Application::instance()->mainWindow()->currentTab()->setFocus();
Application::instance()->mainWindow()->mainView()->urlBar()->setUrl(_url);
Application::historyManager()->addHistoryEntry( _url.prettyUrl() );
+
+ delete _lister;
}
@@ -277,7 +283,11 @@ void ProtocolHandler::slotMostLocalUrlResult(KJob *job)
KIO::StatJob *statJob = static_cast<KIO::StatJob*>(job);
KIO::UDSEntry entry = statJob->statResult();
if( entry.isDir() )
+ {
+ _lister = new KDirLister;
+ connect( _lister, SIGNAL(newItems(const KFileItemList &)), this, SLOT(showResults(const KFileItemList &)));
_lister->openUrl(_url);
+ }
else
emit downloadUrl(_url);
}
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 290ac034..8cb17b17 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -161,13 +161,13 @@ void UrlBar::setProgress(int progress)
void UrlBar::updateUrl()
{
- // Don't change my typed url...
- // FIXME this is not a proper solution (also if it works...)
- if(hasFocus())
- {
- kDebug() << "Don't change my typed url...";
- return;
- }
+// // Don't change my typed url...
+// // FIXME this is not a proper solution (also if it works...)
+// if(hasFocus())
+// {
+// kDebug() << "Don't change my typed url...";
+// return;
+// }
KIcon icon;
if(m_currentUrl.isEmpty())
diff --git a/src/webpage.cpp b/src/webpage.cpp
index ea05c15a..ce2d5e40 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -119,7 +119,6 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r
if ( frame && m_protHandler.preHandling(request, frame) )
{
return false;
-
}
m_requestedUrl = request.url();