X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/be8443bed87c1f27a9cd1f82d969cc06f91c2f62..7a593fc92bf28fbdcdec0e241e18ee8ba2ad7334:/src/filterbar/filterbar.cpp diff --git a/src/filterbar/filterbar.cpp b/src/filterbar/filterbar.cpp index 7a8951743..6de6fbe5c 100644 --- a/src/filterbar/filterbar.cpp +++ b/src/filterbar/filterbar.cpp @@ -1,6 +1,7 @@ /*************************************************************************** * Copyright (C) 2006-2010 by Peter Penz * * Copyright (C) 2006 by Gregor Kališnik * + * Copyright (C) 2012 by Stuart Citrin * * * * 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 * @@ -39,6 +40,14 @@ FilterBar::FilterBar(QWidget* parent) : 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->setAutoRaise(true); + m_lockButton->setCheckable(true); + m_lockButton->setIcon(KIcon("object-unlocked")); + 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); @@ -56,6 +65,7 @@ FilterBar::FilterBar(QWidget* parent) : hLayout->addWidget(closeButton); hLayout->addWidget(filterLabel); hLayout->addWidget(m_filterInput); + hLayout->addWidget(m_lockButton); filterLabel->setBuddy(m_filterInput); } @@ -64,6 +74,15 @@ FilterBar::~FilterBar() { } +void FilterBar::closeFilterBar() +{ + hide(); + clear(); + if (m_lockButton) { + m_lockButton->setChecked(false); + } +} + void FilterBar::selectAll() { m_filterInput->selectAll(); @@ -74,6 +93,23 @@ void FilterBar::clear() m_filterInput->clear(); } +void FilterBar::slotUrlChanged() +{ + if (!m_lockButton || !(m_lockButton->isChecked())) { + clear(); + } +} + +void FilterBar::slotToggleLockButton(bool checked) +{ + if (checked) { + m_lockButton->setIcon(KIcon("object-locked")); + } else { + m_lockButton->setIcon(KIcon("object-unlocked")); + clear(); + } +} + void FilterBar::showEvent(QShowEvent* event) { if (!event->spontaneous()) {