X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/85aec92f819eae5a6189bd3ec25cff44dce3ae19..d2fbbd44b422cc64ad184886670ca22df9dced5b:/src/dolphinviewcontainer.cpp diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 2ef6209bc..794418eab 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -117,6 +117,8 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow, this, SLOT(showInfoMessage(const QString&))); connect(m_dirLister, SIGNAL(errorMessage(const QString&)), this, SLOT(showErrorMessage(const QString&))); + connect(m_dirLister, SIGNAL(urlIsFileError(const KUrl&)), + this, SLOT(openFile(const KUrl&))); m_view = new DolphinView(this, url, @@ -176,11 +178,12 @@ DolphinViewContainer::~DolphinViewContainer() void DolphinViewContainer::setUrl(const KUrl& newUrl) { m_urlNavigator->setUrl(newUrl); - - // Temporary disable the 'File'->'Create New...' menu until - // the write permissions can be checked in a fast way at - // DolphinViewContainer::slotDirListerCompleted(). - m_mainWindow->newMenu()->menu()->setEnabled(false); + if (newUrl != m_urlNavigator->url()) { + // Temporary disable the 'File'->'Create New...' menu until + // the write permissions can be checked in a fast way at + // DolphinViewContainer::slotDirListerCompleted(). + m_mainWindow->newMenu()->menu()->setEnabled(false); + } } const KUrl& DolphinViewContainer::url() const @@ -245,7 +248,7 @@ void DolphinViewContainer::slotDirListerCompleted() } updateStatusBar(); - QTimer::singleShot(100, this, SLOT(restoreContentsPos())); + QMetaObject::invokeMethod(this, "restoreContentsPos", Qt::QueuedConnection); // Enable the 'File'->'Create New...' menu only if the directory // supports writing. @@ -424,4 +427,13 @@ void DolphinViewContainer::slotItemTriggered(const KFileItem& item) item.run(); } +void DolphinViewContainer::openFile(const KUrl& url) +{ + // Using m_dolphinModel for getting the file item instance is not possible + // here: openFile() is triggered by an error of the directory lister + // job, so the file item must be received "manually". + const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url); + slotItemTriggered(item); +} + #include "dolphinviewcontainer.moc"