summaryrefslogtreecommitdiff
path: root/src/protocolhandler.cpp
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/protocolhandler.cpp
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/protocolhandler.cpp')
-rw-r--r--src/protocolhandler.cpp22
1 files changed, 16 insertions, 6 deletions
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);
}