diff options
| author | Felix Ernst <[email protected]> | 2026-04-23 18:22:49 +0200 |
|---|---|---|
| committer | Felix Ernst <[email protected]> | 2026-04-27 13:26:59 +0200 |
| commit | 1e13c6abb6fc179fa8da32fe62df89560a801b3d (patch) | |
| tree | a154114e7144f5b6678e7b394bf7c7423b56051b /src/views/dolphinview.cpp | |
| parent | 2d7dac81ad66672aa2332cc37e3439755fe1f930 (diff) | |
Show type-ahead typing feedback in the status bar
The typed keys are displayed in the status bar while also displaying
which file name they were auto-completed to (i.e. which file was
selected because of the typing).
This commit contains some refactoring to keep the original status bar
functionality working as expected.
This commit also separates DolphinMainWindow from DolphinStatusBar which
is great news architecture-wise. The status bar is encapsulated within
the DolphinViewContainer.
Diffstat (limited to 'src/views/dolphinview.cpp')
| -rw-r--r-- | src/views/dolphinview.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 794223861..3c973618c 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -130,6 +130,25 @@ DolphinView::DolphinView(const QUrl &url, QWidget *parent) KItemListController *controller = new KItemListController(m_model, m_view, this); controller->setAutoActivationEnabled(GeneralSettings::autoExpandFolders()); connect(controller, &KItemListController::doubleClickViewBackground, this, &DolphinView::doubleClickViewBackground); + connect(controller, &KItemListController::typeAheadUsed, this, [this](const QString &typedString, std::optional<int> foundIndex) { + if (foundIndex.has_value()) { + const KFileItem item = m_model->fileItem(foundIndex.value()); + if (item.isNull()) { + return; + } + const KColorScheme colorScheme = KColorScheme(QPalette::Normal, KColorScheme::Tooltip); + const QColor autoCompleteTextColor = colorScheme.foreground(KColorScheme::InactiveText).color(); + + Q_EMIT showTypeAheadFeedback(QStringLiteral("%1<font color=\"%2\">%3</font>") + .arg(typedString.toHtmlEscaped()) + .arg(autoCompleteTextColor.name()) + .arg(item.name().toHtmlEscaped().mid(typedString.size()))); + } else { + const KColorScheme colorScheme = KColorScheme(QPalette::Normal, KColorScheme::Tooltip); + const QColor noMatchTextColor = colorScheme.foreground(KColorScheme::NegativeText).color(); + Q_EMIT showTypeAheadFeedback(QStringLiteral("<font color=\"%1\">%2</font>").arg(noMatchTextColor.name()).arg(typedString.toHtmlEscaped())); + } + }); // The EnlargeSmallPreviews setting can only be changed after the model // has been set in the view by KItemListController. |
