|
|
|
@ -195,23 +195,43 @@ DirFilterPlugin::DirFilterPlugin (QObject* parent, const char* name,
|
|
|
|
|
{
|
|
|
|
|
QWhatsThis::add(m_searchWidget, i18n("Enter here a text which an item in the view must contain anywhere to be shown."));
|
|
|
|
|
connect(clear, SIGNAL(activated()), m_searchWidget, SLOT(clear()));
|
|
|
|
|
connect(m_searchWidget, SIGNAL(textChanged(const QString&)), this, SLOT(searchTextChanged(const QString&)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KWidgetAction *filterAction = new KWidgetAction(hbox, i18n("Filter Field"),
|
|
|
|
|
0, 0, 0, actionCollection(), "toolbar_filter_field");
|
|
|
|
|
filterAction->setShortcutConfigurable(false);
|
|
|
|
|
|
|
|
|
|
// FIXME: This causes crashes for an unknown reason on certain systems
|
|
|
|
|
// Probably the iconview onchange event handler should tempoarily stop this timer before doing anything else
|
|
|
|
|
// Really the broken Qt3 iconview should just be modified to include a hidden list; it would make things *so* much easier!
|
|
|
|
|
m_refreshTimer = new QTimer( this );
|
|
|
|
|
m_reactivateRefreshTimer = new QTimer( this );
|
|
|
|
|
connect( m_refreshTimer, SIGNAL(timeout()), this, SLOT(activateSearch()) );
|
|
|
|
|
m_refreshTimer->start( 200, FALSE ); // 200 millisecond continuous timer
|
|
|
|
|
connect( m_reactivateRefreshTimer, SIGNAL(timeout()), this, SLOT(reactivateRefreshTimer()) );
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DirFilterPlugin::~DirFilterPlugin()
|
|
|
|
|
{
|
|
|
|
|
m_reactivateRefreshTimer->stop();
|
|
|
|
|
m_refreshTimer->stop();
|
|
|
|
|
delete m_pFilterMenu;
|
|
|
|
|
delete m_refreshTimer;
|
|
|
|
|
delete m_reactivateRefreshTimer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DirFilterPlugin::searchTextChanged(const QString& newtext)
|
|
|
|
|
{
|
|
|
|
|
m_refreshTimer->stop();
|
|
|
|
|
m_reactivateRefreshTimer->stop();
|
|
|
|
|
m_reactivateRefreshTimer->start( 1000, TRUE );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DirFilterPlugin::reactivateRefreshTimer()
|
|
|
|
|
{
|
|
|
|
|
m_refreshTimer->start( 200, FALSE ); // 200 millisecond continuous time
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DirFilterPlugin::slotOpenURL ()
|
|
|
|
@ -474,6 +494,10 @@ void DirFilterPlugin::slotItemRemoved (const KFileItem* item)
|
|
|
|
|
|
|
|
|
|
void DirFilterPlugin::activateSearch()
|
|
|
|
|
{
|
|
|
|
|
// FIXME: If any of the files change while they are hidden in iconview mode, they will
|
|
|
|
|
// reappear under the wrong (old) name. This routine was originally intended to fix that
|
|
|
|
|
// problem, but will need to be able to detect when a change has occurred to be effective.
|
|
|
|
|
|
|
|
|
|
if (!m_searchWidget)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|