summaryrefslogtreecommitdiffstats
path: root/tdeio
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-19 15:47:26 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-19 15:47:26 -0500
commit7217eca58605fb57b4dd0ffcd7ca4445681ce619 (patch)
treee38171eebe75ade33b056156ad09b43591a747f2 /tdeio
parent947d16dfde60d75d9cc596673cb1be718c8210d0 (diff)
downloadtdelibs-7217eca58605fb57b4dd0ffcd7ca4445681ce619.tar.gz
tdelibs-7217eca58605fb57b4dd0ffcd7ca4445681ce619.zip
Fix KDirLister failure to emit events for all watchers of a given path
Fix KURL comparison
Diffstat (limited to 'tdeio')
-rw-r--r--tdeio/tdeio/kdirlister.cpp20
-rw-r--r--tdeio/tdeio/kdirwatch.cpp24
2 files changed, 29 insertions, 15 deletions
diff --git a/tdeio/tdeio/kdirlister.cpp b/tdeio/tdeio/kdirlister.cpp
index 8df6755f1..91f025013 100644
--- a/tdeio/tdeio/kdirlister.cpp
+++ b/tdeio/tdeio/kdirlister.cpp
@@ -274,7 +274,7 @@ bool KDirListerCache::listDir( KDirLister *lister, const KURL& _u,
urlsCurrentlyListed[urlStr + ":" + urlReferenceStr]->append( lister );
- TDEIO::ListJob *job = jobForUrl( urlStr );
+ TDEIO::ListJob *job = jobForUrl( urlStr + ":" + urlReferenceStr );
Q_ASSERT( job );
lister->jobStarted( job );
@@ -282,8 +282,9 @@ bool KDirListerCache::listDir( KDirLister *lister, const KURL& _u,
Q_ASSERT( itemU );
- if ( !lister->d->rootFileItem && lister->d->url == _url )
+ if ( !lister->d->rootFileItem && lister->d->url == _url ) {
lister->d->rootFileItem = itemU->rootItem;
+ }
lister->addNewItems( *(itemU->lstItems) );
lister->emitItems();
@@ -343,10 +344,11 @@ void KDirListerCache::stop( KDirLister *lister )
//kdDebug(7004) << k_funcinfo << " found lister in list - for " << url << endl;
bool ret = listers->removeRef( lister );
Q_ASSERT( ret );
-
+
TDEIO::ListJob *job = jobForUrl( url );
- if ( job )
+ if ( job ) {
lister->jobDone( job );
+ }
// move lister to urlsCurrentlyHeld
TQPtrList<KDirLister> *holders = urlsCurrentlyHeld[url];
@@ -411,7 +413,7 @@ void KDirListerCache::stop( KDirLister *lister, const KURL& _u )
holders->append( lister );
- TDEIO::ListJob *job = jobForUrl( urlStr );
+ TDEIO::ListJob *job = jobForUrl( urlStr + ":" + urlReferenceStr );
if ( job )
lister->jobDone( job );
@@ -498,7 +500,7 @@ void KDirListerCache::forgetDirs( KDirLister *lister, const KURL& _url, bool not
itemsInUse.remove( urlStr + ":" + urlReferenceStr );
// this job is a running update
- TDEIO::ListJob *job = jobForUrl( urlStr );
+ TDEIO::ListJob *job = jobForUrl( urlStr + ":" + urlReferenceStr );
if ( job )
{
lister->jobDone( job );
@@ -582,7 +584,7 @@ void KDirListerCache::updateDirectory( const KURL& _dir )
// restart the job for _dir if it is running already
bool killed = false;
TQWidget *window = 0;
- TDEIO::ListJob *job = jobForUrl( urlStr );
+ TDEIO::ListJob *job = jobForUrl( urlStr + ":" + urlReferenceStr );
if ( job )
{
window = job->window();
@@ -1230,7 +1232,7 @@ void KDirListerCache::slotRedirection( TDEIO::Job *j, const KURL& url )
// get the job if one's running for newUrl already (can be a list-job or an update-job), but
// do not return this 'job', which would happen because of the use of redirectionURL()
- TDEIO::ListJob *oldJob = jobForUrl( newUrl.url(), job );
+ TDEIO::ListJob *oldJob = jobForUrl( newUrl.url() + ":" + newUrl.internalReferenceURL(), job );
// listers of newUrl with oldJob: forget about the oldJob and use the already running one
// which will be converted to an updateJob
@@ -1445,7 +1447,7 @@ void KDirListerCache::emitRedirections( const KURL &oldUrl, const KURL &url )
TQString oldReferenceUrlStr = oldUrl.internalReferenceURL();
TQString urlReferenceStr = url.internalReferenceURL();
- TDEIO::ListJob *job = jobForUrl( oldUrlStr );
+ TDEIO::ListJob *job = jobForUrl( oldUrlStr + ":" + oldReferenceUrlStr );
if ( job )
killJob( job );
diff --git a/tdeio/tdeio/kdirwatch.cpp b/tdeio/tdeio/kdirwatch.cpp
index da1f61540..be55c7ea5 100644
--- a/tdeio/tdeio/kdirwatch.cpp
+++ b/tdeio/tdeio/kdirwatch.cpp
@@ -780,8 +780,9 @@ void KDirWatchPrivate::addEntry(KDirWatch* instance, const KURL& _path,
if (path.startsWith("/dev/") || (path == "/dev"))
return; // Don't even go there.
- if ( path.length() > 1 && path.right(1) == "/" )
+ if ( path.length() > 1 && path.right(1) == "/" ) {
path.truncate( path.length() - 1 );
+ }
EntryMap::Iterator it = m_mapEntries.find( _path );
if ( it != m_mapEntries.end() )
@@ -885,8 +886,9 @@ void KDirWatchPrivate::addEntry(KDirWatch* instance, const KURL& _path,
e->m_mode = UnknownMode;
e->msecLeft = 0;
- if ( isNoisyFile( tpath ) )
+ if ( isNoisyFile( tpath ) ) {
return;
+ }
#ifdef HAVE_FAM
if (useFAM(e)) return;
@@ -1324,17 +1326,20 @@ void KDirWatchPrivate::slotRescan()
{
// mark all as dirty
it = m_mapEntries.begin();
- for( ; it != m_mapEntries.end(); ++it )
+ for( ; it != m_mapEntries.end(); ++it ) {
(*it).dirty = true;
+ }
rescan_all = false;
}
else
{
// progate dirty flag to dependant entries (e.g. file watches)
it = m_mapEntries.begin();
- for( ; it != m_mapEntries.end(); ++it )
- if (((*it).m_mode == INotifyMode || (*it).m_mode == DNotifyMode) && (*it).dirty )
+ for( ; it != m_mapEntries.end(); ++it ) {
+ if (((*it).m_mode == INotifyMode || (*it).m_mode == DNotifyMode) && (*it).dirty ) {
(*it).propagate_dirty();
+ }
+ }
}
it = m_mapEntries.begin();
@@ -1381,7 +1386,14 @@ void KDirWatchPrivate::slotRescan()
#endif
if ( ev != NoChange ) {
- emitEvent( &(*it), ev);
+ // Emit events for any entries with the same path as the changed entry
+ EntryMap::Iterator it2;
+ it2 = m_mapEntries.begin();
+ for( ; it2 != m_mapEntries.end(); ++it2 ) {
+ if ((*it).path.url() == (*it2).path.url()) {
+ emitEvent( &(*it2), ev);
+ }
+ }
}
}