┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinmainwindow.cpp
diff options
context:
space:
mode:
authorSebastian Trueg <[email protected]>2010-03-15 09:55:51 +0000
committerSebastian Trueg <[email protected]>2010-03-15 09:55:51 +0000
commitfa24cc8e115e785cc02d0d3d3bf0c1574c783f63 (patch)
treee1fd2422d476551eb38c1d09b033d29f428bfa55 /src/dolphinmainwindow.cpp
parenta80da4153a8f2c1a085ce76869d62d8427781704 (diff)
Stat URLs before opening them to make sure they are actually dirs we can list. Otherwise use KRun.
svn path=/trunk/KDE/kdebase/apps/; revision=1103520
Diffstat (limited to 'src/dolphinmainwindow.cpp')
-rw-r--r--src/dolphinmainwindow.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index d358ad733..da4cab597 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -121,7 +121,8 @@ DolphinMainWindow::DolphinMainWindow(int id) :
m_actionHandler(0),
m_remoteEncoding(0),
m_settingsDialog(0),
- m_captionStatJob(0)
+ m_captionStatJob(0),
+ m_lastHandleUrlStatJob(0)
{
setObjectName("Dolphin#");
@@ -1132,7 +1133,28 @@ void DolphinMainWindow::showSearchOptions()
void DolphinMainWindow::handleUrl(const KUrl& url)
{
- if (KProtocolManager::supportsListing(url)) {
+ delete m_lastHandleUrlStatJob;
+ m_lastHandleUrlStatJob = 0;
+
+ if (url.isLocalFile() && QFileInfo(url.toLocalFile()).isDir()) {
+ activeViewContainer()->setUrl(url);
+ } else if (KProtocolManager::supportsListing(url)) {
+ // stat the URL to see if it is a dir or not
+ m_lastHandleUrlStatJob = KIO::stat(url, KIO::HideProgressInfo);
+ connect(m_lastHandleUrlStatJob, SIGNAL(result(KJob*)),
+ this, SLOT(slotHandleUrlStatFinished(KJob*)));
+
+ } else {
+ new KRun(url, this);
+ }
+}
+
+void DolphinMainWindow::slotHandleUrlStatFinished(KJob* job)
+{
+ m_lastHandleUrlStatJob = 0;
+ const KIO::UDSEntry entry = static_cast<KIO::StatJob*>(job)->statResult();
+ const KUrl url = static_cast<KIO::StatJob*>(job)->url();
+ if ( entry.isDir() ) {
activeViewContainer()->setUrl(url);
} else {
new KRun(url, this);