┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMéven Car <[email protected]>2020-12-02 07:07:41 +0000
committerMéven Car <[email protected]>2020-12-02 07:07:41 +0000
commit60b9eaa4c1c4d3057934d2cefbbe986553090ab3 (patch)
tree0b7db540efc47439862a3e11f5e1419c33d03694 /src
parentce11325115b8655fd687c78fdf0b1c358806195e (diff)
Toolbar: move and rename filter to edit menu above Search
This is to expose more filter. Also rename "Show Filter Bar" to simply "Filter", keep "Show Filter Bar" as tooltip Adds a toggle filter bar action.
Diffstat (limited to 'src')
-rw-r--r--src/dolphinmainwindow.cpp54
-rw-r--r--src/dolphinmainwindow.h1
-rw-r--r--src/dolphinui.rc4
3 files changed, 42 insertions, 17 deletions
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 "
+ "<emphasis>Filter Bar</emphasis> at the bottom of the window.<nl/> "
+ "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 "
- "<emphasis>Filter Bar</emphasis> at the bottom of the window.<nl/> "
- "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 @@
<Action name="copy_location" />
<Action name="edit_paste" />
<Separator />
+ <Action name="show_filter_bar" />
<Action name="edit_find" />
<Separator />
<Action name="copy_to_inactive_split_view" />
@@ -66,7 +67,6 @@
<Action name="closed_tabs" />
</Menu>
<Menu name="tools">
- <Action name="show_filter_bar" />
<Action name="open_preferred_search_tool" />
<Action name="open_terminal" />
<Action name="focus_terminal_panel"/>
@@ -124,6 +124,7 @@
<Action name="split_view" />
<Action name="split_stash" />
<Action name="toggle_search" />
+ <Action name="toggle_filter" />
</ToolBar>
<ActionProperties scheme="Default">
<Action priority="0" name="go_back"/>
@@ -141,5 +142,6 @@
<Action priority="0" name="edit_copy"/>
<Action priority="0" name="edit_paste"/>
<Action priority="0" name="toggle_search"/>
+ <Action priority="0" name="toggle_filter"/>
</ActionProperties>
</gui>