[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/apps/dolphin/src
From:       Peter Penz <peter.penz19 () gmail ! com>
Date:       2010-12-19 12:03:46
Message-ID: 20101219120346.86271AC8AA () svn ! kde ! org
[Download RAW message or body]

SVN commit 1207719 by ppenz:

Select the whole text in the filterbar and searchbox if the widget has lost the focus \
and gets focused again by the shortcut (this behavior is consistent to e.g. the \
behavior in Kate).

CCBUG: 256160


 M  +5 -0      dolphinviewcontainer.cpp  
 M  +6 -1      filterbar/filterbar.cpp  
 M  +7 -2      filterbar/filterbar.h  
 M  +6 -0      search/dolphinsearchbox.cpp  
 M  +5 -0      search/dolphinsearchbox.h  


--- trunk/KDE/kdebase/apps/dolphin/src/dolphinviewcontainer.cpp #1207718:1207719
@@ -239,6 +239,10 @@
 void DolphinViewContainer::setSearchModeEnabled(bool enabled)
 {
     if (enabled == isSearchModeEnabled()) {
+        if (enabled && !m_searchBox->hasFocus()) {
+            m_searchBox->setFocus();
+            m_searchBox->selectAll();
+        }
         return;
     }
 
@@ -295,6 +299,7 @@
     if (visible) {
         m_filterBar->show();
         m_filterBar->setFocus();
+        m_filterBar->selectAll();
     } else {
         closeFilterBar();
     }
--- trunk/KDE/kdebase/apps/dolphin/src/filterbar/filterbar.cpp #1207718:1207719
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   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  *
@@ -64,6 +64,11 @@
 {
 }
 
+void FilterBar::selectAll()
+{
+    m_filterInput->selectAll();
+}
+
 void FilterBar::clear()
 {
     m_filterInput->clear();
--- trunk/KDE/kdebase/apps/dolphin/src/filterbar/filterbar.h #1207718:1207719
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   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  *
@@ -17,6 +17,7 @@
  *   Free Software Foundation, Inc.,                                       *
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
+
 #ifndef FILTERBAR_H
 #define FILTERBAR_H
 
@@ -28,7 +29,6 @@
  * @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
 {
@@ -38,6 +38,11 @@
     FilterBar(QWidget* parent = 0);
     virtual ~FilterBar();
 
+    /**
+     * Selects the whole text of the filter bar.
+     */
+    void selectAll();
+
 public slots:
     /** Clears the input field. */
     void clear();
--- trunk/KDE/kdebase/apps/dolphin/src/search/dolphinsearchbox.cpp #1207718:1207719
@@ -134,6 +134,11 @@
     return url;
 }
 
+void DolphinSearchBox::selectAll()
+{
+    m_searchInput->selectAll();
+}
+
 bool DolphinSearchBox::event(QEvent* event)
 {
     if (event->type() == QEvent::Polish) {
@@ -243,6 +248,7 @@
     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)),
--- trunk/KDE/kdebase/apps/dolphin/src/search/dolphinsearchbox.h #1207718:1207719
@@ -64,6 +64,11 @@
     /** @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);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic