summaryrefslogtreecommitdiffstats
path: root/konq-plugins
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-06-29 18:51:09 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-06-29 18:51:09 +0000
commit23a3d3aa5b44cbdf305495919866d9dbf4f6da54 (patch)
tree2e832fc7948609543899f741ebd1747950d8fc97 /konq-plugins
parent8a34a88474735ca9b090a8e17b674f856a59be70 (diff)
downloadtdeaddons-23a3d3aa5b44cbdf305495919866d9dbf4f6da54.tar.gz
tdeaddons-23a3d3aa5b44cbdf305495919866d9dbf4f6da54.zip
Attempt to fix a race condition and subsequent crash
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1144369 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konq-plugins')
-rw-r--r--konq-plugins/dirfilter/dirfilterplugin.cpp24
-rw-r--r--konq-plugins/dirfilter/dirfilterplugin.h3
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;