X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/046ddcf5607e597cd6290147bf7ee10c08e526dd..58062f9a3973c1445cb2a5a4c8b77deadb99099d:/src/dolphinviewcontainer.cpp diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index e55519d04..62c29a1fc 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -33,6 +33,9 @@ #include #include +#ifndef QT_NO_ACCESSIBILITY +#include +#endif #include #include #include @@ -436,6 +439,14 @@ void DolphinViewContainer::showMessage(const QString &message, KMessageWidget::M m_messageWidget->hide(); } m_messageWidget->animatedShow(); + +#ifndef QT_NO_ACCESSIBILITY + if (QAccessible::isActive() && isActive()) { + // To announce the new message keyboard focus must be moved to the message label. However, we do not have direct access to the label that is internal + // to the KMessageWidget. Instead we setFocus() on the KMessageWidget and trust that it has set correct focus handling. + m_messageWidget->setFocus(); + } +#endif } void DolphinViewContainer::readSettings() @@ -975,10 +986,13 @@ void DolphinViewContainer::slotCurrentDirectoryRemoved() const QString dirPath = url().toLocalFile(); const QString newPath = getNearestExistingAncestorOfPath(dirPath); const QUrl newUrl = QUrl::fromLocalFile(newPath); - setUrl(newUrl); - } - - showMessage(xi18n("Current location changed, %1 is no longer accessible.", location), KMessageWidget::Warning); + // #473377: Delay changing the url to avoid modifying KCoreDirLister before KCoreDirListerCache::deleteDir() returns. + QTimer::singleShot(0, this, [&, newUrl, location] { + setUrl(newUrl); + showMessage(xi18n("Current location changed, %1 is no longer accessible.", location), KMessageWidget::Warning); + }); + } else + showMessage(xi18n("Current location changed, %1 is no longer accessible.", location), KMessageWidget::Warning); } void DolphinViewContainer::slotOpenUrlFinished(KJob *job)