connect(m_filterBar, SIGNAL(focusViewRequest()),
this, SLOT(requestFocus()));
connect(m_view, SIGNAL(urlChanged(KUrl)),
- m_filterBar, SLOT(clear()));
+ m_filterBar, SLOT(slotUrlChanged()));
m_topLayout->addWidget(m_urlNavigator);
m_topLayout->addWidget(m_searchBox);
void DolphinViewContainer::closeFilterBar()
{
- m_filterBar->hide();
- m_filterBar->clear();
+ m_filterBar->closeFilterBar();
m_view->setFocus();
emit showFilterBarChanged(false);
}
/***************************************************************************
* Copyright (C) 2006-2010 by Peter Penz <peter.penz19@gmail.com> *
* Copyright (C) 2006 by Gregor Kališnik <gregor@podnapisi.net> *
+ * Copyright (C) 2012 by Stuart Citrin <ctrn3e8@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
closeButton->setToolTip(i18nc("@info:tooltip", "Hide Filter Bar"));
connect(closeButton, SIGNAL(clicked()), this, SIGNAL(closeRequest()));
+ // Create button to lock text when changing folders
+ m_lockButton = new QToolButton(this);
+ m_lockButton->setCheckable(true);
+ m_lockButton->setIcon(KIcon("system-lock-screen.png"));
+ m_lockButton->setToolTip(i18nc("@info:tooltip", "Keep Filter When Changing Folders"));
+ connect(m_lockButton, SIGNAL(toggled(bool)), this, SLOT(slotToggleLockButton(bool)));
+
// Create label
QLabel* filterLabel = new QLabel(i18nc("@label:textbox", "Filter:"), this);
hLayout->addWidget(closeButton);
hLayout->addWidget(filterLabel);
hLayout->addWidget(m_filterInput);
+ hLayout->addWidget(m_lockButton);
filterLabel->setBuddy(m_filterInput);
}
{
}
+void FilterBar::closeFilterBar()
+{
+ hide();
+ clear();
+ if (m_lockButton) {
+ m_lockButton->setChecked(false);
+ }
+}
+
void FilterBar::selectAll()
{
m_filterInput->selectAll();
m_filterInput->clear();
}
+void FilterBar::slotUrlChanged()
+{
+ if (!m_lockButton || !(m_lockButton->isChecked())) {
+ clear();
+ }
+}
+
+void FilterBar::slotToggleLockButton(bool checked)
+{
+ if (!checked) {
+ clear();
+ }
+}
+
void FilterBar::showEvent(QShowEvent* event)
{
if (!event->spontaneous()) {
/***************************************************************************
* Copyright (C) 2006-2010 by Peter Penz <peter.penz19@gmail.com> *
* Copyright (C) 2006 by Gregor Kališnik <gregor@podnapisi.net> *
+ * Copyright (C) 2012 by Stuart Citrin <ctrn3e8@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
#include <QWidget>
class KLineEdit;
+class QToolButton;
/**
* @brief Provides an input field for filtering the currently shown items.
explicit FilterBar(QWidget* parent = 0);
virtual ~FilterBar();
+ /** Called by view container to hide this **/
+ void closeFilterBar();
+
/**
* Selects the whole text of the filter bar.
*/
public slots:
/** Clears the input field. */
void clear();
+ /** Clears the input field if the "lock button" is disabled. */
+ void slotUrlChanged();
+ /** The input field is cleared also if the "lock button" is released. */
+ void slotToggleLockButton(bool checked);
signals:
/**
private:
KLineEdit* m_filterInput;
+ QToolButton* m_lockButton;
};
#endif