forked from qt-creator/qt-creator
Locator: Fix opening of remote files
Opening remote files can pop up a ssh prompt, and before that happens we need to hide the locator popup, which otherwise can stay on front of that ssh prompt window, preventing the user from entering their password and opening the file. Otherwise for example modal error dialogs could also be shown. So, delay the EditorManager::open call to after the popup is hidden. Amends07b1e1c5fe
and7f49d93fc1
Change-Id: If2dd9e745d5d98615b851ee4315e7de9a75afb00 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -1016,10 +1016,17 @@ void LocatorWidget::acceptEntry(int row)
|
||||
const QModelIndex index = m_locatorModel->index(row, 0);
|
||||
if (!index.isValid())
|
||||
return;
|
||||
const LocatorFilterEntry entry = m_locatorModel->data(index, LocatorEntryRole).value<LocatorFilterEntry>();
|
||||
const LocatorFilterEntry entry
|
||||
= m_locatorModel->data(index, LocatorEntryRole).value<LocatorFilterEntry>();
|
||||
if (!entry.acceptor) {
|
||||
// Opening editors can open dialogs (e.g. the ssh prompt, or showing erros), so delay until
|
||||
// we have hidden the popup with emit hidePopup below and Qt actually processed that
|
||||
QMetaObject::invokeMethod(
|
||||
EditorManager::instance(),
|
||||
[entry] { EditorManager::openEditor(entry); },
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
QWidget *focusBeforeAccept = QApplication::focusWidget();
|
||||
if (!entry.acceptor)
|
||||
EditorManager::openEditor(entry);
|
||||
const AcceptResult result = entry.acceptor ? entry.acceptor() : AcceptResult();
|
||||
if (result.newText.isEmpty()) {
|
||||
emit hidePopup();
|
||||
|
Reference in New Issue
Block a user