Use placeholder for search action

Summary:
See https://hig.kde.org/style/writing/placeholder.html

Screenshot:

Old: {F6691712}
New: {F6698685}

Test Plan: Compile and run

Reviewers: #dolphin, #vdg, ngraham, elvisangelaccio

Reviewed By: #dolphin, #vdg, ngraham

Subscribers: GB_2, kde-doc-english, elvisangelaccio, ngraham, yurchor, kfm-devel

Tags: #dolphin, #documentation

Maniphest Tasks: T10258

Differential Revision: https://phabricator.kde.org/D19770
This commit is contained in:
Carl Schwan 2019-03-14 20:53:49 +01:00
parent 832fd09655
commit 8dc5c7a199
No known key found for this signature in database
GPG key ID: 2E102E8C54ED43DC
5 changed files with 12 additions and 16 deletions

View file

@ -782,7 +782,7 @@ current folder, &RMB; click in the work space and click
<para> <para>
&dolphin; is capable of searching for files and for content in files. If <keycombo action="simul"> &dolphin; is capable of searching for files and for content in files. If <keycombo action="simul">
&Ctrl;<keycap>F</keycap></keycombo> is pressed or <menuchoice> <guimenu>Edit</guimenu> &Ctrl;<keycap>F</keycap></keycombo> is pressed or <menuchoice> <guimenu>Edit</guimenu>
<guimenuitem>Find...</guimenuitem> </menuchoice> is used, the <guilabel>Find</guilabel> <guimenuitem>Search...</guimenuitem> </menuchoice> is used, the <guilabel>Search</guilabel>
bar will open already set up to search for files within the current folder and any sub-folders. bar will open already set up to search for files within the current folder and any sub-folders.
Start to type into the find input box and the search starts immediately. Start to type into the find input box and the search starts immediately.
<screenshot> <screenshot>
@ -821,7 +821,7 @@ starts the search from the user's <replaceable>Home</replaceable> folder.</para>
</screenshot> </screenshot>
<para> <para>
Use the <guilabel>More Options</guilabel> button to extend the <guilabel>Find</guilabel> Use the <guilabel>More Options</guilabel> button to extend the <guilabel>Search</guilabel>
bar. This provides a very comfortable way for bar. This provides a very comfortable way for
the user to shrink the number of search results.</para> the user to shrink the number of search results.</para>
<para>To start a search select one or more file types (<guilabel>Documents</guilabel>, <para>To start a search select one or more file types (<guilabel>Documents</guilabel>,
@ -1693,7 +1693,7 @@ The name of this file has to be entered in a dialog.
<keycombo action="simul">&Ctrl;<keycap>F</keycap></keycombo> <keycombo action="simul">&Ctrl;<keycap>F</keycap></keycombo>
</shortcut> </shortcut>
<guimenu>Edit</guimenu> <guimenu>Edit</guimenu>
<guimenuitem>Find...</guimenuitem> <guimenuitem>Search...</guimenuitem>
</menuchoice></term> </menuchoice></term>
<listitem><para><action>Opens the find bar. Enter a search term into the edit box and select to search for filename <listitem><para><action>Opens the find bar. Enter a search term into the edit box and select to search for filename
or in contents of files starting from the current folder or everywhere.</action></para></listitem> or in contents of files starting from the current folder or everywhere.</action></para></listitem>

View file

@ -928,9 +928,13 @@ void DolphinMainWindow::updateControlMenu()
menu->addSeparator(); menu->addSeparator();
// Overwrite Find action to Search action
QAction *searchAction = ac->action(KStandardAction::name(KStandardAction::Find));
searchAction->setText(i18n("Search..."));
// Add "Edit" actions // Add "Edit" actions
bool added = addActionToMenu(ac->action(KStandardAction::name(KStandardAction::Undo)), menu) | bool added = addActionToMenu(ac->action(KStandardAction::name(KStandardAction::Undo)), menu) |
addActionToMenu(ac->action(KStandardAction::name(KStandardAction::Find)), menu) | addActionToMenu(searchAction, menu) |
addActionToMenu(ac->action(KStandardAction::name(KStandardAction::SelectAll)), menu) | addActionToMenu(ac->action(KStandardAction::name(KStandardAction::SelectAll)), menu) |
addActionToMenu(ac->action(QStringLiteral("invert_selection")), menu); addActionToMenu(ac->action(QStringLiteral("invert_selection")), menu);
@ -1140,7 +1144,8 @@ void DolphinMainWindow::setupActions()
// due to the long text, the text "Paste" is used: // due to the long text, the text "Paste" is used:
paste->setIconText(i18nc("@action:inmenu Edit", "Paste")); paste->setIconText(i18nc("@action:inmenu Edit", "Paste"));
KStandardAction::find(this, &DolphinMainWindow::find, actionCollection()); QAction *searchAction = KStandardAction::find(this, &DolphinMainWindow::find, actionCollection());
searchAction->setText(i18n("Search..."));
KStandardAction::selectAll(this, &DolphinMainWindow::selectAll, actionCollection()); KStandardAction::selectAll(this, &DolphinMainWindow::selectAll, actionCollection());

View file

@ -47,13 +47,12 @@ FilterBar::FilterBar(QWidget* parent) :
m_lockButton->setToolTip(i18nc("@info:tooltip", "Keep Filter When Changing Folders")); m_lockButton->setToolTip(i18nc("@info:tooltip", "Keep Filter When Changing Folders"));
connect(m_lockButton, &QToolButton::toggled, this, &FilterBar::slotToggleLockButton); connect(m_lockButton, &QToolButton::toggled, this, &FilterBar::slotToggleLockButton);
// Create label
QLabel* filterLabel = new QLabel(i18nc("@label:textbox", "Filter:"), this);
// Create filter editor // Create filter editor
m_filterInput = new QLineEdit(this); m_filterInput = new QLineEdit(this);
m_filterInput->setLayoutDirection(Qt::LeftToRight); m_filterInput->setLayoutDirection(Qt::LeftToRight);
m_filterInput->setClearButtonEnabled(true); m_filterInput->setClearButtonEnabled(true);
m_filterInput->setPlaceholderText(i18n("Filter..."));
connect(m_filterInput, &QLineEdit::textChanged, connect(m_filterInput, &QLineEdit::textChanged,
this, &FilterBar::filterChanged); this, &FilterBar::filterChanged);
setFocusProxy(m_filterInput); setFocusProxy(m_filterInput);
@ -62,11 +61,8 @@ FilterBar::FilterBar(QWidget* parent) :
QHBoxLayout* hLayout = new QHBoxLayout(this); QHBoxLayout* hLayout = new QHBoxLayout(this);
hLayout->setContentsMargins(0, 0, 0, 0); hLayout->setContentsMargins(0, 0, 0, 0);
hLayout->addWidget(closeButton); hLayout->addWidget(closeButton);
hLayout->addWidget(filterLabel);
hLayout->addWidget(m_filterInput); hLayout->addWidget(m_filterInput);
hLayout->addWidget(m_lockButton); hLayout->addWidget(m_lockButton);
filterLabel->setBuddy(m_filterInput);
} }
FilterBar::~FilterBar() FilterBar::~FilterBar()

View file

@ -49,7 +49,6 @@ DolphinSearchBox::DolphinSearchBox(QWidget* parent) :
m_startedSearching(false), m_startedSearching(false),
m_active(true), m_active(true),
m_topLayout(nullptr), m_topLayout(nullptr),
m_searchLabel(nullptr),
m_searchInput(nullptr), m_searchInput(nullptr),
m_saveSearchAction(nullptr), m_saveSearchAction(nullptr),
m_optionsScrollArea(nullptr), m_optionsScrollArea(nullptr),
@ -355,11 +354,9 @@ void DolphinSearchBox::init()
closeButton->setToolTip(i18nc("@info:tooltip", "Quit searching")); closeButton->setToolTip(i18nc("@info:tooltip", "Quit searching"));
connect(closeButton, &QToolButton::clicked, this, &DolphinSearchBox::emitCloseRequest); connect(closeButton, &QToolButton::clicked, this, &DolphinSearchBox::emitCloseRequest);
// Create search label
m_searchLabel = new QLabel(this);
// Create search box // Create search box
m_searchInput = new QLineEdit(this); m_searchInput = new QLineEdit(this);
m_searchInput->setPlaceholderText(i18n("Search..."));
m_searchInput->installEventFilter(this); m_searchInput->installEventFilter(this);
m_searchInput->setClearButtonEnabled(true); m_searchInput->setClearButtonEnabled(true);
m_searchInput->setFont(QFontDatabase::systemFont(QFontDatabase::GeneralFont)); m_searchInput->setFont(QFontDatabase::systemFont(QFontDatabase::GeneralFont));
@ -381,7 +378,6 @@ void DolphinSearchBox::init()
QHBoxLayout* searchInputLayout = new QHBoxLayout(); QHBoxLayout* searchInputLayout = new QHBoxLayout();
searchInputLayout->setContentsMargins(0, 0, 0, 0); searchInputLayout->setContentsMargins(0, 0, 0, 0);
searchInputLayout->addWidget(closeButton); searchInputLayout->addWidget(closeButton);
searchInputLayout->addWidget(m_searchLabel);
searchInputLayout->addWidget(m_searchInput); searchInputLayout->addWidget(m_searchInput);
// Create "Filename" and "Content" button // Create "Filename" and "Content" button

View file

@ -166,7 +166,6 @@ private:
QVBoxLayout* m_topLayout; QVBoxLayout* m_topLayout;
QLabel* m_searchLabel;
QLineEdit* m_searchInput; QLineEdit* m_searchInput;
QAction* m_saveSearchAction; QAction* m_saveSearchAction;
QScrollArea* m_optionsScrollArea; QScrollArea* m_optionsScrollArea;