1
/***************************************************************************
2
* Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
3
* Copyright (C) 2006 by Gregor Kališnik <gregor@podnapisi.net> *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19
***************************************************************************/
20
#include "filterbar.h"
25
#include <Q3VBoxLayout>
27
#include <Q3HBoxLayout>
31
#include <kpushbutton.h>
32
#include <klineedit.h>
33
#include <kiconloader.h>
37
FilterBar::FilterBar(QWidget *parent, const char *name) :
42
Q3VBoxLayout* foo = new Q3VBoxLayout(this);
45
Q3HBoxLayout* layout = new Q3HBoxLayout(foo);
46
layout->addSpacing(gap);
48
m_filter = new QLabel(i18n("Filter:"), this);
49
layout->addWidget(m_filter);
50
layout->addSpacing(KDialog::spacingHint());
52
m_filterInput = new KLineEdit(this);
53
layout->addWidget(m_filterInput);
55
m_close = new KPushButton(this);
56
m_close->setIconSet(SmallIcon("fileclose"));
57
m_close->setFlat(true);
58
layout->addWidget(m_close);
59
layout->addSpacing(gap);
61
connect(m_filterInput, SIGNAL(textChanged(const QString&)),
62
this, SIGNAL(signalFilterChanged(const QString&)));
63
connect(m_close, SIGNAL(clicked()), this, SLOT(hide()));
64
connect(m_close, SIGNAL(clicked()),
65
&Dolphin::mainWin(), SLOT(slotShowFilterBarChanged()));
68
FilterBar::~FilterBar()
72
void FilterBar::hide()
74
m_filterInput->clear();
75
m_filterInput->clearFocus();
79
void FilterBar::show()
81
m_filterInput->setFocus();
85
void FilterBar::keyReleaseEvent(QKeyEvent* event)
87
QWidget::keyReleaseEvent(event);
88
if ((event->key() == Qt::Key_Escape)) {
90
Dolphin::mainWin().slotShowFilterBarChanged();
94
#include "filterbar.moc"