Commit 60950f52 authored by loh.tar's avatar loh.tar Committed by Christoph Cullmann
Browse files

Avoid QTimer, use signal finishedLoading

parent 3e0a9464
......@@ -36,7 +36,6 @@
#include <QDir>
#include <QLineEdit>
#include <QStyle>
#include <QTimer>
#include <QVBoxLayout>
// END Includes
......@@ -117,6 +116,13 @@ KateFileBrowser::KateFileBrowser(KTextEditor::MainWindow *mainWindow, QWidget *p
connect(m_dirOperator, &KDirOperator::contextMenuAboutToShow, this, &KateFileBrowser::contextMenuAboutToShow);
// Ensure highlight current document also works after directory change
connect(m_dirOperator, &KDirOperator::finishedLoading, this, [this] {
if (m_autoSyncFolder->isChecked()) {
m_dirOperator->setCurrentItem(activeDocumentUrl());
}
});
autoSyncFolder();
}
......@@ -330,11 +336,8 @@ void KateFileBrowser::autoSyncFolder()
{
if (m_autoSyncFolder->isChecked()) {
setActiveDocumentDir();
// Highlight current document. 300 was the lowest delay working also on startup
QTimer::singleShot(300, this, [this] {
m_dirOperator->view()->clearSelection();
m_dirOperator->view()->keyboardSearch(activeDocumentUrl().fileName());
});
// Highlight current document
m_dirOperator->setCurrentItem(activeDocumentUrl());
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment