diff options
Diffstat (limited to 'konq-plugins')
-rw-r--r-- | konq-plugins/dirfilter/dirfilterplugin.cpp | 24 | ||||
-rw-r--r-- | konq-plugins/dirfilter/dirfilterplugin.h | 3 |
2 files changed, 27 insertions, 0 deletions
diff --git a/konq-plugins/dirfilter/dirfilterplugin.cpp b/konq-plugins/dirfilter/dirfilterplugin.cpp index dbf034f..8401238 100644 --- a/konq-plugins/dirfilter/dirfilterplugin.cpp +++ b/konq-plugins/dirfilter/dirfilterplugin.cpp @@ -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; diff --git a/konq-plugins/dirfilter/dirfilterplugin.h b/konq-plugins/dirfilter/dirfilterplugin.h index 963d731..c1313be 100644 --- a/konq-plugins/dirfilter/dirfilterplugin.h +++ b/konq-plugins/dirfilter/dirfilterplugin.h @@ -121,11 +121,14 @@ private slots: void slotItemRemoved(const KFileItem *); void slotItemsAdded(const KFileItemList &); void activateSearch(); + void searchTextChanged(const QString& newtext); + void reactivateRefreshTimer(); private: KURL m_pURL; KonqDirPart* m_part; QTimer *m_refreshTimer; + QTimer *m_reactivateRefreshTimer; KActionMenu* m_pFilterMenu; QString m_oldFilterString; |