void DolphinViewContainer::setSearchModeEnabled(bool enabled)
{
if (enabled == isSearchModeEnabled()) {
+ if (enabled && !m_searchBox->hasFocus()) {
+ m_searchBox->setFocus();
+ m_searchBox->selectAll();
+ }
return;
}
if (visible) {
m_filterBar->show();
m_filterBar->setFocus();
+ m_filterBar->selectAll();
} else {
closeFilterBar();
}
/***************************************************************************
- * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
+ * Copyright (C) 2006-2010 by Peter Penz <peter.penz19@gmail.com> *
* Copyright (C) 2006 by Gregor Kališnik <gregor@podnapisi.net> *
* *
* This program is free software; you can redistribute it and/or modify *
{
}
+void FilterBar::selectAll()
+{
+ m_filterInput->selectAll();
+}
+
void FilterBar::clear()
{
m_filterInput->clear();
/***************************************************************************
- * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
+ * Copyright (C) 2006-2010 by Peter Penz <peter.penz19@gmail.com> *
* Copyright (C) 2006 by Gregor Kališnik <gregor@podnapisi.net> *
* *
* This program is free software; you can redistribute it and/or modify *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
+
#ifndef FILTERBAR_H
#define FILTERBAR_H
* @brief Provides an input field for filtering the currently shown items.
*
* @author Gregor Kališnik <gregor@podnapisi.net>
- * @author Peter Penz <peter.penz@gmx.at>
*/
class FilterBar : public QWidget
{
FilterBar(QWidget* parent = 0);
virtual ~FilterBar();
+ /**
+ * Selects the whole text of the filter bar.
+ */
+ void selectAll();
+
public slots:
/** Clears the input field. */
void clear();
return url;
}
+void DolphinSearchBox::selectAll()
+{
+ m_searchInput->selectAll();
+}
+
bool DolphinSearchBox::event(QEvent* event)
{
if (event->type() == QEvent::Polish) {
m_searchInput = new KLineEdit(this);
m_searchInput->setClearButtonShown(true);
m_searchInput->setFont(KGlobalSettings::generalFont());
+ setFocusProxy(m_searchInput);
connect(m_searchInput, SIGNAL(returnPressed(QString)),
this, SLOT(slotReturnPressed(QString)));
connect(m_searchInput, SIGNAL(textChanged(QString)),
/** @return URL that will start the searching of files. */
KUrl urlForSearching() const;
+ /**
+ * Selects the whole text of the search box.
+ */
+ void selectAll();
+
protected:
virtual bool event(QEvent* event);
virtual void showEvent(QShowEvent* event);