Skip to content
Snippets Groups Projects
Commit c89e237d authored by con's avatar con
Browse files

Fix Locator's file system filter.

This always selected the whole filter text when entering a directory.
parent e10c0c96
No related branches found
No related tags found
No related merge requests found
...@@ -94,8 +94,8 @@ void FileSystemFilter::accept(FilterEntry selection) const ...@@ -94,8 +94,8 @@ void FileSystemFilter::accept(FilterEntry selection) const
{ {
QFileInfo info(selection.internalData.toString()); QFileInfo info(selection.internalData.toString());
if (info.isDir()) { if (info.isDir()) {
m_toolWindow->show(shortcutString()+" " QString value = shortcutString() + " " + QDir::toNativeSeparators(info.absoluteFilePath()+"/");
+QDir::toNativeSeparators(info.absoluteFilePath()+"/")); m_toolWindow->show(value, value.length());
return; return;
} }
m_editorManager->openEditor(selection.internalData.toString()); m_editorManager->openEditor(selection.internalData.toString());
......
...@@ -345,8 +345,6 @@ bool QuickOpenToolWindow::eventFilter(QObject *obj, QEvent *event) ...@@ -345,8 +345,6 @@ bool QuickOpenToolWindow::eventFilter(QObject *obj, QEvent *event)
} else if (obj == m_fileLineEdit && event->type() == QEvent::FocusOut) { } else if (obj == m_fileLineEdit && event->type() == QEvent::FocusOut) {
m_completionList->hide(); m_completionList->hide();
} else if (obj == m_fileLineEdit && event->type() == QEvent::FocusIn) { } else if (obj == m_fileLineEdit && event->type() == QEvent::FocusIn) {
if (static_cast<QFocusEvent*>(event)->reason() != Qt::MouseFocusReason)
m_fileLineEdit->selectAll();
showPopup(); showPopup();
} else if (obj == this && event->type() == QEvent::ShortcutOverride) { } else if (obj == this && event->type() == QEvent::ShortcutOverride) {
QKeyEvent *ke = static_cast<QKeyEvent *>(event); QKeyEvent *ke = static_cast<QKeyEvent *>(event);
...@@ -445,10 +443,13 @@ void QuickOpenToolWindow::show(const QString &text, int selectionStart, int sele ...@@ -445,10 +443,13 @@ void QuickOpenToolWindow::show(const QString &text, int selectionStart, int sele
else else
showPopup(); showPopup();
if (selectionStart >= 0) if (selectionStart >= 0) {
m_fileLineEdit->setSelection(selectionStart, selectionLength); m_fileLineEdit->setSelection(selectionStart, selectionLength);
else if (selectionLength == 0) // make sure the cursor is at the right position (Mac-vs.-rest difference)
m_fileLineEdit->setCursorPosition(selectionStart);
} else {
m_fileLineEdit->selectAll(); m_fileLineEdit->selectAll();
}
} }
void QuickOpenToolWindow::filterSelected() void QuickOpenToolWindow::filterSelected()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment