diff --git a/doc/index.docbook b/doc/index.docbook index 50fc37d91..589e09e1b 100644 --- a/doc/index.docbook +++ b/doc/index.docbook @@ -775,6 +775,26 @@ current folder, &RMB; click in the work space and click + +Filtering Files + + +&dolphin; is capable of filtering files, &ie; showing only those items in the +view whose name contains a given text. For example, if you wish to show +only the MP3 files within a folder, you could filter for .mp3. +This would then filter out all files whose name does not contain .mp3. + + + +To filter files, first enable the filter bar, either by pressing &Ctrl;I +or via the menu: Edit Filter... . +You can then enter the text to be filtered for in the filter bar. The filter bar can +be disabled either by pressing &Esc;, or with a &LMB; click on the +Hide Filter Bar icon. + + + + Finding Files and Searching in Files @@ -912,26 +932,6 @@ via the Tools menu: Tools Compare F - -Filtering Files - - -&dolphin; is capable of filtering files, &ie; showing only those items in the -view whose name contains a given text. For example, if you wish to show -only the MP3 files within a folder, you could filter for .mp3. -This would then filter out all files whose name does not contain .mp3. - - - -To filter files, first enable the filter bar, either by pressing &Ctrl;I -or via the menu: Tools Show Filter Bar . -You can then enter the text to be filtered for in the filter bar. The filter bar can -be disabled either by pressing &Esc;, or with a &LMB; click on the -Hide Filter Bar icon. - - - - @@ -1752,6 +1752,19 @@ The name of this file has to be entered in a dialog. Is disabled if the current user does not have write permission on the selected item(s). + + + +&Ctrl;I + +Edit +Filter... + +Enables and disables the filter bar. +You can also use the alternate shortcut &Shift;/ +for this action. + + @@ -2052,19 +2065,6 @@ be reopened. - - - -&Ctrl;I - -Tools -Show Filter Bar - -Enables and disables the filter bar. -You can also use the alternate shortcut &Shift;/ -for this action. - - diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 64268542d..fb6da0b4a 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -173,8 +173,8 @@ DolphinMainWindow::DolphinMainWindow() : connect(clipboard, &QClipboard::dataChanged, this, &DolphinMainWindow::updatePasteAction); - QAction* showFilterBarAction = actionCollection()->action(QStringLiteral("show_filter_bar")); - showFilterBarAction->setChecked(generalSettings->filterBar()); + QAction* toggleFilterBarAction = actionCollection()->action(QStringLiteral("toggle_filter")); + toggleFilterBarAction->setChecked(generalSettings->filterBar()); if (firstRun) { menuBar()->setVisible(false); @@ -383,8 +383,8 @@ void DolphinMainWindow::updateHistory() void DolphinMainWindow::updateFilterBarAction(bool show) { - QAction* showFilterBarAction = actionCollection()->action(QStringLiteral("show_filter_bar")); - showFilterBarAction->setChecked(show); + QAction* toggleFilterBarAction = actionCollection()->action(QStringLiteral("toggle_filter")); + toggleFilterBarAction->setChecked(show); } void DolphinMainWindow::openNewMainWindow() @@ -847,6 +847,15 @@ void DolphinMainWindow::showFilterBar() m_activeViewContainer->setFilterBarVisible(true); } +void DolphinMainWindow::toggleFilterBar() +{ + bool checked = !m_activeViewContainer->isFilterBarVisible(); + m_activeViewContainer->setFilterBarVisible(checked); + + QAction* toggleFilterBarAction = actionCollection()->action(QStringLiteral("toggle_filter")); + toggleFilterBarAction->setChecked(checked); +} + void DolphinMainWindow::toggleEditLocation() { clearStatusBar(); @@ -1442,6 +1451,29 @@ void DolphinMainWindow::setupActions() actionCollection()->setDefaultShortcut(moveToOtherViewAction, Qt::SHIFT + Qt::Key_F6 ); connect(moveToOtherViewAction, &QAction::triggered, m_tabWidget, &DolphinTabWidget::moveToInactiveSplitView); + QAction* showFilterBar = actionCollection()->addAction(QStringLiteral("show_filter_bar")); + showFilterBar->setText(i18nc("@action:inmenu Tools", "Filter...")); + showFilterBar->setToolTip(i18nc("@info:tooltip", "Toggle Filter Bar")); + showFilterBar->setWhatsThis(xi18nc("@info:whatsthis", "This opens the " + "Filter Bar at the bottom of the window. " + "There you can enter a text to filter the files and folders currently displayed. " + "Only those that contain the text in their name will be kept in view.")); + showFilterBar->setIcon(QIcon::fromTheme(QStringLiteral("view-filter"))); + actionCollection()->setDefaultShortcuts(showFilterBar, {Qt::CTRL + Qt::Key_I, Qt::Key_Slash}); + connect(showFilterBar, &QAction::triggered, this, &DolphinMainWindow::showFilterBar); + + // toggle_filter acts as a copy of the main showFilterBar to be used mainly + // in the toolbar, with no default shortcut attached, to avoid messing with + // existing workflows (filter bar always open and Ctrl-I to focus) + QAction *toggleFilter = actionCollection()->addAction(QStringLiteral("toggle_filter")); + toggleFilter->setText(i18nc("@action:inmenu", "Toggle Filter Bar")); + toggleFilter->setIconText(i18nc("@action:intoolbar", "Filter")); + toggleFilter->setIcon(showFilterBar->icon()); + toggleFilter->setToolTip(showFilterBar->toolTip()); + toggleFilter->setWhatsThis(showFilterBar->whatsThis()); + toggleFilter->setCheckable(true); + connect(toggleFilter, &QAction::triggered, this, &DolphinMainWindow::toggleFilterBar); + QAction *searchAction = KStandardAction::find(this, &DolphinMainWindow::find, actionCollection()); searchAction->setText(i18n("Search...")); searchAction->setToolTip(i18nc("@info:tooltip", "Search for files and folders")); @@ -1597,16 +1629,6 @@ void DolphinMainWindow::setupActions() "including folders that contain personal application data.")); // setup 'Tools' menu - QAction* showFilterBar = actionCollection()->addAction(QStringLiteral("show_filter_bar")); - showFilterBar->setText(i18nc("@action:inmenu Tools", "Show Filter Bar")); - showFilterBar->setWhatsThis(xi18nc("@info:whatsthis", "This opens the " - "Filter Bar at the bottom of the window. " - "There you can enter a text to filter the files and folders currently displayed. " - "Only those that contain the text in their name will be kept in view.")); - showFilterBar->setIcon(QIcon::fromTheme(QStringLiteral("view-filter"))); - actionCollection()->setDefaultShortcuts(showFilterBar, {Qt::CTRL + Qt::Key_I, Qt::Key_Slash}); - connect(showFilterBar, &QAction::triggered, this, &DolphinMainWindow::showFilterBar); - QAction* compareFiles = actionCollection()->addAction(QStringLiteral("compare_files")); compareFiles->setText(i18nc("@action:inmenu Tools", "Compare Files")); compareFiles->setIcon(QIcon::fromTheme(QStringLiteral("kompare"))); @@ -2032,8 +2054,8 @@ void DolphinMainWindow::updateViewActions() { m_actionHandler->updateViewActions(); - QAction* showFilterBarAction = actionCollection()->action(QStringLiteral("show_filter_bar")); - showFilterBarAction->setChecked(m_activeViewContainer->isFilterBarVisible()); + QAction* toggleFilterBarAction = actionCollection()->action(QStringLiteral("toggle_filter")); + toggleFilterBarAction->setChecked(m_activeViewContainer->isFilterBarVisible()); updateSplitAction(); } diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index 8d5eae344..8e031fd03 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -312,6 +312,7 @@ private slots: void disableStopAction(); void showFilterBar(); + void toggleFilterBar(); /** * Toggles between edit and browse mode of the navigation bar. diff --git a/src/dolphinui.rc b/src/dolphinui.rc index 01458f2c6..e749abae0 100644 --- a/src/dolphinui.rc +++ b/src/dolphinui.rc @@ -28,6 +28,7 @@ + @@ -66,7 +67,6 @@ - @@ -124,6 +124,7 @@ + @@ -141,5 +142,6 @@ +