File indexing completed on 2024-05-05 04:49:25

0001 /****************************************************************************************
0002  * Copyright (c) 2009 Seb Ruiz <ruiz@kde.org>                                           *
0003  * Copyright (c) 2010 Rick W. Chen <stuffcorpse@archlinux.us>                           *
0004  *                                                                                      *
0005  * This program is free software; you can redistribute it and/or modify it under        *
0006  * the terms of the GNU General Public License as published by the Free Software        *
0007  * Foundation; either version 2 of the License, or (at your option) any later           *
0008  * version.                                                                             *
0009  *                                                                                      *
0010  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0012  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0013  *                                                                                      *
0014  * You should have received a copy of the GNU General Public License along with         *
0015  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0016  ****************************************************************************************/
0017 
0018 #include "ComboBox.h"
0019 
0020 #include <QKeyEvent>
0021 
0022 namespace Amarok
0023 {
0024 
0025 ComboBox::ComboBox( QWidget *parent )
0026    : KComboBox( parent )
0027 {
0028     setEditable( true );
0029 }
0030 
0031 void ComboBox::keyPressEvent( QKeyEvent *event )
0032 {
0033     if( event->key() == Qt::Key_Escape )
0034     {
0035         event->accept();
0036         clearEditText();
0037         return;
0038     }
0039     else if( event->key() == Qt::Key_Down )
0040     {
0041         event->accept();
0042         Q_EMIT downPressed();
0043         return;
0044     }
0045     KComboBox::keyPressEvent( event );
0046 }
0047 
0048 } // namespace AMAROK
0049