QWidget(parent),
m_startedSearching(false),
m_readOnly(false),
+ m_active(true),
m_topLayout(0),
m_searchLabel(0),
m_searchInput(0),
void DolphinSearchBox::setReadOnly(bool readOnly, const KUrl& query)
{
- if (m_readOnly != readOnly) {
+ if (m_readOnly != readOnly || m_readOnlyQuery != query) {
m_readOnly = readOnly;
m_readOnlyQuery = query;
applyReadOnlyState();
return m_readOnly;
}
+void DolphinSearchBox::setActive(bool active)
+{
+ if (active != m_active) {
+ m_active = active;
+
+ if (active) {
+ emit activated();
+ }
+ }
+}
+
+bool DolphinSearchBox::isActive() const
+{
+ return m_active;
+}
+
bool DolphinSearchBox::event(QEvent* event)
{
if (event->type() == QEvent::Polish) {
}
}
+bool DolphinSearchBox::eventFilter(QObject* obj, QEvent* event)
+{
+ switch (event->type()) {
+ case QEvent::FocusIn:
+ setActive(true);
+ setFocus();
+ break;
+
+ default:
+ break;
+ }
+
+ return QObject::eventFilter(obj, event);
+}
+
void DolphinSearchBox::emitSearchRequest()
{
m_startSearchTimer->stop();
void DolphinSearchBox::initButton(QToolButton* button)
{
+ button->installEventFilter(this);
button->setAutoExclusive(true);
button->setAutoRaise(true);
button->setCheckable(true);
// Create search box
m_searchInput = new KLineEdit(this);
+ m_searchInput->installEventFilter(this);
m_searchInput->setClearButtonShown(true);
m_searchInput->setFont(KGlobalSettings::generalFont());
setFocusProxy(m_searchInput);
connect(m_facetsToggleButton, SIGNAL(clicked()), this, SLOT(slotFacetsButtonToggled()));
m_facetsWidget = new DolphinFacetsWidget(this);
+ m_facetsWidget->installEventFilter(this);
m_facetsWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
connect(m_facetsWidget, SIGNAL(facetChanged()), this, SLOT(slotFacetChanged()));
const bool facetsIsVisible = SearchSettings::showFacetsWidget();
m_facetsToggleButton->setChecked(facetsIsVisible ? true : false);
m_facetsToggleButton->setIcon(KIcon(facetsIsVisible ? "arrow-up-double" : "arrow-down-double"));
- m_facetsToggleButton->setText(facetsIsVisible ? i18nc("action:button", "Less Options") : i18nc("action:button", "More Options"));
+ m_facetsToggleButton->setText(facetsIsVisible ? i18nc("action:button", "Fewer Options") : i18nc("action:button", "More Options"));
}
#include "dolphinsearchbox.moc"