diff options
author | Timothy Pearson <[email protected]> | 2013-04-19 15:47:26 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2013-04-19 15:47:26 -0500 |
commit | 7217eca58605fb57b4dd0ffcd7ca4445681ce619 (patch) | |
tree | e38171eebe75ade33b056156ad09b43591a747f2 | |
parent | 947d16dfde60d75d9cc596673cb1be718c8210d0 (diff) | |
download | tdelibs-7217eca58605fb57b4dd0ffcd7ca4445681ce619.tar.gz tdelibs-7217eca58605fb57b4dd0ffcd7ca4445681ce619.zip |
Fix KDirLister failure to emit events for all watchers of a given path
Fix KURL comparison
-rw-r--r-- | tdecore/kurl.cpp | 6 | ||||
-rw-r--r-- | tdecore/kurl.h | 1 | ||||
-rw-r--r-- | tdeio/tdeio/kdirlister.cpp | 20 | ||||
-rw-r--r-- | tdeio/tdeio/kdirwatch.cpp | 24 |
4 files changed, 34 insertions, 17 deletions
diff --git a/tdecore/kurl.cpp b/tdecore/kurl.cpp index a0e61ad32..7d9c3f5a6 100644 --- a/tdecore/kurl.cpp +++ b/tdecore/kurl.cpp @@ -1140,6 +1140,9 @@ bool KURL::operator<( const KURL& _u) const i = m_strPass.compare(_u.m_strPass); if (i) return (i < 0); + i = d->m_strInternalReferenceURL.compare(_u.d->m_strInternalReferenceURL); + if (i) return (i < 0); + return false; } @@ -1196,7 +1199,8 @@ bool KURL::equals( const KURL &_u, bool ignore_trailing ) const m_strHost == _u.m_strHost && m_strQuery_encoded == _u.m_strQuery_encoded && m_strRef_encoded == _u.m_strRef_encoded && - m_iPort == _u.m_iPort ) + m_iPort == _u.m_iPort && + d->m_strInternalReferenceURL == _u.d->m_strInternalReferenceURL ) return true; return false; diff --git a/tdecore/kurl.h b/tdecore/kurl.h index cb1615cd2..bcb44907e 100644 --- a/tdecore/kurl.h +++ b/tdecore/kurl.h @@ -1797,7 +1797,6 @@ private: TQString m_strPath; TQString m_strRef_encoded; TQString m_strQuery_encoded; - TQString m_strInternalReferenceURL; bool m_bIsMalformed : 1; enum URIMode m_iUriMode : 3; uint freeForUse : 4; 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); + } + } } } |