Fix a number of problems with the forwarding slave and dirlister

Fix TDE HW library not detecting mounted drives
pull/16/head
Timothy Pearson 12 years ago
parent 43e139235d
commit 4d6667159e

@ -298,7 +298,9 @@ static void kDebugBackend( unsigned short nLevel, unsigned int nArea, const char
}
case 2: // Shell
{
write( 2, buf, strlen( buf ) ); //fputs( buf, stderr );
if (write( 2, buf, strlen( buf ) ) < 0) { //fputs( buf, stderr );
// ERROR
}
break;
}
case 3: // syslog

@ -400,6 +400,12 @@ static TQString cleanpath(const TQString &_path, bool cleanDirSeparator, bool de
return result;
}
class KURLPrivate
{
public:
TQString m_strInternalReferenceURL;
};
bool KURL::isRelativeURL(const TQString &_url)
{
int len = _url.length();
@ -454,6 +460,7 @@ TQStringList KURL::List::toStringList() const
KURL::KURL()
{
d = new KURLPrivate();
reset();
}
@ -464,25 +471,30 @@ KURL::~KURL()
KURL::KURL( const TQString &url, int encoding_hint )
{
d = new KURLPrivate();
reset();
parse( url, encoding_hint );
}
KURL::KURL( const char * url, int encoding_hint )
{
d = new KURLPrivate();
reset();
parse( TQString::fromLatin1(url), encoding_hint );
}
KURL::KURL( const TQCString& url, int encoding_hint )
{
d = new KURLPrivate();
reset();
parse( TQString::fromLatin1(url), encoding_hint );
}
KURL::KURL( const KURL& _u )
{
d = new KURLPrivate();
*this = _u;
d->m_strInternalReferenceURL = _u.d->m_strInternalReferenceURL;
}
TQDataStream & operator<< (TQDataStream & s, const KURL & a)
@ -521,12 +533,16 @@ TQDataStream & operator>> (TQDataStream & s, KURL & a)
#ifndef QT_NO_NETWORKPROTOCOL
KURL::KURL( const TQUrl &u )
{
d = new KURLPrivate();
*this = u;
}
#endif
KURL::KURL( const KURL& _u, const TQString& _rel_url, int encoding_hint )
{
d = new KURLPrivate();
d->m_strInternalReferenceURL = _u.d->m_strInternalReferenceURL;
if (_u.hasSubURL()) // Operate on the last suburl, not the first
{
KURL::List lst = split( _u );
@ -534,6 +550,7 @@ KURL::KURL( const KURL& _u, const TQString& _rel_url, int encoding_hint )
lst.remove( lst.last() );
lst.append( u );
*this = join( lst );
d->m_strInternalReferenceURL = _u.d->m_strInternalReferenceURL;
return;
}
// WORKAROUND THE RFC 1606 LOOPHOLE THAT ALLOWS
@ -1077,6 +1094,7 @@ KURL& KURL::operator=( const KURL& _u )
m_bIsMalformed = _u.m_bIsMalformed;
m_iPort = _u.m_iPort;
m_iUriMode = _u.m_iUriMode;
d->m_strInternalReferenceURL = _u.d->m_strInternalReferenceURL;
return *this;
}
@ -1137,7 +1155,8 @@ bool KURL::operator==( const KURL& _u ) const
m_strPath_encoded == _u.m_strPath_encoded ) &&
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;
}
@ -2295,6 +2314,13 @@ TQString KURL::relativePath(const TQString &base_dir, const TQString &path, bool
return result;
}
void KURL::setInternalReferenceURL( const TQString& url ) {
d->m_strInternalReferenceURL = url;
}
TQString KURL::internalReferenceURL( void ) const {
return d->m_strInternalReferenceURL;
}
TQString KURL::relativeURL(const KURL &base_url, const KURL &url, int encoding_hint)
{

@ -590,6 +590,16 @@ public:
*/
bool hasPath() const { return !m_strPath.isEmpty(); }
/**
* @brief @internal
*/
void setInternalReferenceURL( const TQString& url );
/**
* @brief @internal
*/
TQString internalReferenceURL( void ) const;
/**
* @brief Resolves @c "." and @c ".." components in path
*

@ -868,7 +868,7 @@ TQString TDEStorageDevice::mountPath() {
TQStringList mountInfo = TQStringList::split(" ", line, true);
TQString testNode = *mountInfo.at(0);
// Check for match
if ((testNode == deviceNode()) || (testNode == dmaltname)) {
if ((testNode == deviceNode()) || (testNode == dmaltname) || (testNode == ("/dev/disk/by-uuid/" + diskUUID()))) {
TQString ret = *mountInfo.at(1);
ret.replace("\\040", " ");
return ret;

@ -63,8 +63,8 @@ KDirListerCache::KDirListerCache( int maxCount )
urlsCurrentlyHeld.setAutoDelete( true );
pendingUpdates.setAutoDelete( true );
connect( kdirwatch, TQT_SIGNAL( dirty( const TQString& ) ),
this, TQT_SLOT( slotFileDirty( const TQString& ) ) );
connect( kdirwatch, TQT_SIGNAL( dirty( const KURL& ) ),
this, TQT_SLOT( slotFileDirty( const KURL& ) ) );
connect( kdirwatch, TQT_SIGNAL( created( const TQString& ) ),
this, TQT_SLOT( slotFileCreated( const TQString& ) ) );
connect( kdirwatch, TQT_SIGNAL( deleted( const TQString& ) ),
@ -99,7 +99,6 @@ bool KDirListerCache::listDir( KDirLister *lister, const KURL& _u,
// Strangely, slotUpdateResult *is* called if the user instead right-clicks on the unmounted media device and selects Mount from the context menu
if ((_u.protocol() == "media") && (_u.path() == "/")) {
_reload = true;
_keep = false;
}
// like this we don't have to worry about trailing slashes any further
@ -162,8 +161,9 @@ bool KDirListerCache::listDir( KDirLister *lister, const KURL& _u,
emit lister->started( _url );
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();
@ -174,9 +174,10 @@ bool KDirListerCache::listDir( KDirLister *lister, const KURL& _u,
lister->d->complete = oldState;
emit lister->completed( _url );
if ( lister->d->complete )
lister->emitCompleted( _url );
if ( lister->d->complete ) {
emit lister->completed();
}
if ( _reload || !itemU->complete ) {
updateDirectory( _url );
@ -209,9 +210,10 @@ bool KDirListerCache::listDir( KDirLister *lister, const KURL& _u,
lister->d->complete = oldState;
emit lister->completed( _url );
if ( lister->d->complete )
lister->emitCompleted( _url );
if ( lister->d->complete ) {
emit lister->completed();
}
if ( !itemC->complete ) {
updateDirectory( _url );
@ -237,8 +239,9 @@ bool KDirListerCache::listDir( KDirLister *lister, const KURL& _u,
// else
// {
if ( lister->d->url == _url )
if ( lister->d->url == _url ) {
lister->d->rootFileItem = 0;
}
TDEIO::ListJob* job = TDEIO::listDir( _url, false /* no default GUI */ );
jobs.insert( job, TQValueList<TDEIO::UDSEntry>() );
@ -246,8 +249,9 @@ bool KDirListerCache::listDir( KDirLister *lister, const KURL& _u,
lister->jobStarted( job );
lister->connectJob( job );
if ( lister->d->window )
if ( lister->d->window ) {
job->setWindow( lister->d->window );
}
connect( job, TQT_SIGNAL( entries( TDEIO::Job *, const TDEIO::UDSEntryList & ) ),
this, TQT_SLOT( slotEntries( TDEIO::Job *, const TDEIO::UDSEntryList & ) ) );
@ -285,8 +289,9 @@ bool KDirListerCache::listDir( KDirLister *lister, const KURL& _u,
}
// automatic updating of directories
if ( lister->d->autoUpdate )
if ( lister->d->autoUpdate ) {
itemU->incAutoUpdate();
}
return true;
}
@ -744,9 +749,11 @@ void KDirListerCache::FilesRemoved( const KURL::List &fileList )
if ( fileitem )
{
TQPtrList<KDirLister> *listers = urlsCurrentlyHeld[parentDir.url()];
if ( listers )
for ( KDirLister *kdl = listers->first(); kdl; kdl = listers->next() )
if ( listers ) {
for ( KDirLister *kdl = listers->first(); kdl; kdl = listers->next() ) {
kdl->emitDeleteItem( fileitem );
}
}
}
// If we found a fileitem, we can test if it's a dir. If not, we'll go to deleteDir just in case.
@ -893,26 +900,26 @@ bool KDirListerCache::exists()
// private slots
// _file can also be a directory being currently held!
void KDirListerCache::slotFileDirty( const TQString& _file )
void KDirListerCache::slotFileDirty( const KURL& _url )
{
kdDebug(7004) << k_funcinfo << _file << endl;
kdDebug(7004) << k_funcinfo << _url << endl;
if ( !pendingUpdates[_file] )
if ( !pendingUpdates[_url.path()] )
{
KURL dir;
dir.setPath( _file );
dir.setPath( _url.path() );
if ( checkUpdate( dir.url(-1) ) ) {
updateDirectory( dir );
updateDirectory( _url );
}
// the parent directory of _file
// the parent directory of _url.path()
dir.setPath( dir.directory() );
if ( checkUpdate( dir.url() ) )
{
// Nice hack to save memory: use the qt object name to store the filename
TQTimer *timer = new TQTimer( this, _file.utf8() );
TQTimer *timer = new TQTimer( this, _url.path().utf8() );
connect( timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotFileDirtyDelayed()) );
pendingUpdates.insert( _file, timer );
pendingUpdates.insert( _url.path(), timer );
timer->start( 500, true );
}
}
@ -976,8 +983,9 @@ void KDirListerCache::slotEntries( TDEIO::Job *job, const TDEIO::UDSEntryList &e
// check if anyone wants the mimetypes immediately
bool delayedMimeTypes = true;
for ( KDirLister *kdl = listers->first(); kdl; kdl = listers->next() )
for ( KDirLister *kdl = listers->first(); kdl; kdl = listers->next() ) {
delayedMimeTypes = delayedMimeTypes && kdl->d->delayedMimeTypes;
}
// avoid creating these QStrings again and again
static const TQString& dot = TDEGlobal::staticQString(".");
@ -992,16 +1000,17 @@ void KDirListerCache::slotEntries( TDEIO::Job *job, const TDEIO::UDSEntryList &e
// find out about the name
TDEIO::UDSEntry::ConstIterator entit = (*it).begin();
for( ; entit != (*it).end(); ++entit )
if ( (*entit).m_uds == TDEIO::UDS_NAME )
{
for( ; entit != (*it).end(); ++entit ) {
if ( (*entit).m_uds == TDEIO::UDS_NAME ) {
name = (*entit).m_str;
break;
}
}
Q_ASSERT( !name.isEmpty() );
if ( name.isEmpty() )
if ( name.isEmpty() ) {
continue;
}
if ( name == dot )
{
@ -1082,7 +1091,7 @@ void KDirListerCache::slotResult( TDEIO::Job *j )
for ( kdl = listers->first(); kdl; kdl = listers->next() )
{
kdl->jobDone( job );
emit kdl->completed( jobUrl );
kdl->emitCompleted( jobUrl );
if ( kdl->numJobs() == 0 )
{
kdl->d->complete = true;
@ -1500,6 +1509,7 @@ void KDirListerCache::slotUpdateResult( TDEIO::Job * j )
KURL jobUrl = joburl( job );
jobUrl.adjustPath(-1); // need remove trailing slashes again, in case of redirections
TQString jobUrlStr = jobUrl.url();
TQString jobReferenceUrlStr = jobUrl.internalReferenceURL();
kdDebug(7004) << k_funcinfo << "finished update " << jobUrl << endl;
@ -1674,7 +1684,7 @@ void KDirListerCache::slotUpdateResult( TDEIO::Job * j )
kdl->jobDone( job );
emit kdl->completed( jobUrl );
kdl->emitCompleted( jobUrl );
if ( kdl->numJobs() == 0 )
{
kdl->d->complete = true;
@ -1705,10 +1715,12 @@ TDEIO::ListJob *KDirListerCache::jobForUrl( const TQString& url, TDEIO::ListJob
const KURL& KDirListerCache::joburl( TDEIO::ListJob *job )
{
if ( job->redirectionURL().isValid() )
if ( job->redirectionURL().isValid() ) {
return job->redirectionURL();
else
}
else {
return job->url();
}
}
void KDirListerCache::killJob( TDEIO::ListJob *job )
@ -1727,11 +1739,13 @@ void KDirListerCache::deleteUnmarkedItems( TQPtrList<KDirLister> *listers, KFile
if ( !item->isMarked() )
{
//kdDebug() << k_funcinfo << item->name() << endl;
for ( KDirLister *kdl = listers->first(); kdl; kdl = listers->next() )
for ( KDirLister *kdl = listers->first(); kdl; kdl = listers->next() ) {
kdl->emitDeleteItem( item );
}
if ( item->isDir() )
if ( item->isDir() ) {
deleteDir( item->url() );
}
// finally actually delete the item
lstItems->take();
@ -1907,45 +1921,50 @@ bool KDirLister::openURL( const KURL& _url, bool _keep, bool _reload )
<< " keep=" << _keep << " reload=" << _reload << endl;
// emit the current changes made to avoid an inconsistent treeview
if ( d->changes != NONE && _keep )
if ( d->changes != NONE && _keep ) {
emitChanges();
}
d->changes = NONE;
// If a local path is available, monitor that instead of the given remote URL...
KURL realURL = _url;
d->providedURL = _url;
if (!realURL.isLocalFile()) {
if (!_url.isLocalFile()) {
TDEIO::LocalURLJob* localURLJob = TDEIO::localURL(_url);
if (localURLJob) {
connect(localURLJob, TQT_SIGNAL(localURL(TDEIO::Job*, const KURL&, bool)), this, TQT_SLOT(slotLocalURL(TDEIO::Job*, const KURL&, bool)));
d->openURL_url[localURLJob] = _url;
d->openURL_keep[localURLJob] = _keep;
d->openURL_reload[localURLJob] = _reload;
connect(localURLJob, TQT_SIGNAL(localURL(TDEIO::Job*, const KURL&, bool)), this, TQT_SLOT(slotOpenURLGotLocalURL(TDEIO::Job*, const KURL&, bool)));
connect(localURLJob, TQT_SIGNAL(destroyed()), this, TQT_SLOT(slotLocalURLKIODestroyed()));
d->localURLSlotFired = false;
while (!d->localURLSlotFired) {
tqApp->eventLoop()->processEvents(TQEventLoop::ExcludeUserInput);
usleep(1000);
}
if (d->localURLResultIsLocal) {
realURL = d->localURLResultURL;
}
}
return true;
}
else {
return s_pCache->listDir( this, _url, _keep, _reload );
}
d->listerURL = realURL;
return s_pCache->listDir( this, realURL, _keep, _reload );
}
void KDirLister::slotLocalURL(TDEIO::Job *job, const KURL& url, bool isLocal) {
d->localURLSlotFired = true;
d->localURLResultURL = url;
d->localURLResultIsLocal = isLocal;
void KDirLister::slotOpenURLGotLocalURL(TDEIO::Job *job, const KURL& url, bool isLocal) {
KURL realURL = d->openURL_url[job];
if (isLocal) {
realURL = url;
realURL.setInternalReferenceURL(d->openURL_url[job].url());
d->m_referenceURLMap[d->openURL_url[job].url()] = url.path();
}
s_pCache->listDir( this, realURL, d->openURL_keep[job], d->openURL_reload[job] );
d->openURL_url.remove(job);
d->openURL_keep.remove(job);
d->openURL_reload.remove(job);
}
void KDirLister::slotLocalURLKIODestroyed() {
if (!d->localURLSlotFired) {
d->localURLSlotFired = true;
d->localURLResultURL = KURL();
d->localURLResultIsLocal = false;
TDEIO::LocalURLJob* terminatedJob = const_cast<TDEIO::LocalURLJob*>(static_cast<const TDEIO::LocalURLJob*>(sender()));
if (d->openURL_url.contains(terminatedJob)) {
s_pCache->listDir( this, d->openURL_url[terminatedJob], d->openURL_keep[terminatedJob], d->openURL_reload[terminatedJob] );
d->openURL_url.remove(terminatedJob);
d->openURL_keep.remove(terminatedJob);
d->openURL_reload.remove(terminatedJob);
}
}
@ -1953,12 +1972,14 @@ void KDirLister::stop()
{
kdDebug(7003) << k_funcinfo << endl;
s_pCache->stop( this );
d->m_referenceURLMap.clear();
}
void KDirLister::stop( const KURL& _url )
{
kdDebug(7003) << k_funcinfo << _url.prettyURL() << endl;
s_pCache->stop( this, _url );
d->m_referenceURLMap.remove(_url.url());
}
bool KDirLister::autoUpdate() const
@ -2319,15 +2340,20 @@ void KDirLister::addNewItem( const KFileItem *item )
return; // No reason to continue... bailing out here prevents a mimetype scan.
}
if (d->listerURL != d->providedURL) {
if ((item->url().internalReferenceURL() != "")
&& (d->m_referenceURLMap.contains(item->url().internalReferenceURL()))) {
// Likely a media:/ tdeioslave URL or similar
// Rewrite the URL to ensure that the user remains within the media:/ tree!
TQString itemPath = item->url().path();
if (itemPath.startsWith(d->listerURL.path())) {
itemPath = itemPath.remove(0, d->listerURL.path().length());
itemPath = d->providedURL.pathOrURL() + itemPath;
if (itemPath.startsWith(d->m_referenceURLMap[item->url().internalReferenceURL()])) {
itemPath = itemPath.remove(0, d->m_referenceURLMap[item->url().internalReferenceURL()].length());
TQString newPath = item->url().internalReferenceURL();
if (!newPath.endsWith("/")) newPath = newPath + "/";
while (itemPath.startsWith("/")) itemPath = itemPath.remove(0,1);
while (itemPath.endsWith("/")) itemPath.truncate(itemPath.length()-1);
newPath = newPath + itemPath;
const_cast<KFileItem*>(item)->setListerURL(item->url());
const_cast<KFileItem*>(item)->setURL(itemPath);
const_cast<KFileItem*>(item)->setURL(newPath);
}
}
@ -2375,6 +2401,23 @@ void KDirLister::addRefreshItem( const KFileItem *item )
{
bool isExcluded = (d->dirOnlyMode && !item->isDir()) || !matchesFilter( item );
if ((item->url().internalReferenceURL() != "")
&& (d->m_referenceURLMap.contains(item->url().internalReferenceURL()))) {
// Likely a media:/ tdeioslave URL or similar
// Rewrite the URL to ensure that the user remains within the media:/ tree!
TQString itemPath = item->url().path();
if (itemPath.startsWith(d->m_referenceURLMap[item->url().internalReferenceURL()])) {
itemPath = itemPath.remove(0, d->m_referenceURLMap[item->url().internalReferenceURL()].length());
TQString newPath = item->url().internalReferenceURL();
if (!newPath.endsWith("/")) newPath = newPath + "/";
while (itemPath.startsWith("/")) itemPath = itemPath.remove(0,1);
while (itemPath.endsWith("/")) itemPath.truncate(itemPath.length()-1);
newPath = newPath + itemPath;
const_cast<KFileItem*>(item)->setListerURL(item->url());
const_cast<KFileItem*>(item)->setURL(newPath);
}
}
if ( !isExcluded && matchesMimeFilter( item ) )
{
if ( d->refreshItemWasFiltered )
@ -2422,7 +2465,31 @@ void KDirLister::emitItems()
if ( tmpNew )
{
emit newItems( *tmpNew );
// For historical reasons, items with different protocols and/or prefixes must be emitted separately
TQString protocol;
TQString prefix;
TQString prevProtocol;
TQString prevPrefix;
KFileItemList emitList;
for ( KFileItemListIterator kit( *tmpNew ); kit.current(); ++kit )
{
KFileItem *item = *kit;
protocol = item->url().protocol();
prefix = TQStringList::split("/", item->url().path())[0];
if ((protocol != prevProtocol) || (prefix != prevPrefix)) {
if (emitList.count() > 0) {
emit newItems( emitList );
emitList.clear();
}
}
emitList.append(item);
prevProtocol = protocol;
prevPrefix = prefix;
}
if (emitList.count() > 0) {
emit newItems( emitList );
}
delete tmpNew;
}
@ -2449,10 +2516,13 @@ void KDirLister::emitItems()
void KDirLister::emitDeleteItem( KFileItem *item )
{
if ( ( d->dirOnlyMode && !item->isDir() ) || !matchesFilter( item ) )
if ( ( d->dirOnlyMode && !item->isDir() ) || !matchesFilter( item ) ) {
return; // No reason to continue... bailing out here prevents a mimetype scan.
if ( matchesMimeFilter( item ) )
}
if ( matchesMimeFilter( item ) ) {
emit deleteItem( item );
}
}
@ -2567,6 +2637,29 @@ void KDirLister::connectJob( TDEIO::ListJob *job )
this, TQT_SLOT(slotSpeed( TDEIO::Job *, unsigned long )) );
}
void KDirLister::emitCompleted( const KURL& _url )
{
KURL emitURL = _url;
if ((_url.internalReferenceURL() != "")
&& (d->m_referenceURLMap.contains(_url.internalReferenceURL()))) {
// Likely a media:/ tdeioslave URL or similar
// Rewrite the URL to ensure that the user remains within the media:/ tree!
TQString itemPath = _url.path();
if (itemPath.startsWith(d->m_referenceURLMap[_url.internalReferenceURL()])) {
itemPath = itemPath.remove(0, d->m_referenceURLMap[_url.internalReferenceURL()].length());
TQString newPath = _url.internalReferenceURL();
if (!newPath.endsWith("/")) newPath = newPath + "/";
while (itemPath.startsWith("/")) itemPath = itemPath.remove(0,1);
while (itemPath.endsWith("/")) itemPath.truncate(itemPath.length()-1);
newPath = newPath + itemPath;
emitURL = newPath;
}
}
emit completed( emitURL );
}
void KDirLister::setMainWindow( TQWidget *window )
{
d->window = window;

@ -100,7 +100,7 @@ public:
* Use only when opening a dir not yet listed by this lister
* without using the cache. Otherwise use updateDirectory.
* @return true if successful,
* false otherwise (e.g. invalid @p _url)
* false otherwise (e.g. unable to communicate with tdeio slave)
*/
virtual bool openURL( const KURL& _url, bool _keep = false, bool _reload = false );
@ -609,7 +609,7 @@ private slots:
void slotTotalSize( TDEIO::Job *, TDEIO::filesize_t );
void slotProcessedSize( TDEIO::Job *, TDEIO::filesize_t );
void slotSpeed( TDEIO::Job *, unsigned long );
void slotLocalURL( TDEIO::Job *, const KURL&, bool );
void slotOpenURLGotLocalURL( TDEIO::Job *, const KURL&, bool );
void slotLocalURLKIODestroyed( );
private:
@ -619,6 +619,9 @@ private:
uint numJobs();
public:
void emitCompleted( const KURL& _url );
private:
virtual void addNewItem( const KFileItem *item );
virtual void addNewItems( const KFileItemList& items );

@ -36,7 +36,6 @@ class TQTimer;
class KDirLister;
namespace TDEIO { class Job; class ListJob; }
class KDirLister::KDirListerPrivate
{
public:
@ -112,11 +111,11 @@ public:
TQStringList mimeFilter, oldMimeFilter;
TQStringList mimeExcludeFilter, oldMimeExcludeFilter;
bool localURLSlotFired;
KURL localURLResultURL;
bool localURLResultIsLocal;
KURL providedURL;
KURL listerURL;
TQMap<TDEIO::Job*, KURL> openURL_url;
TQMap<TDEIO::Job*, bool> openURL_keep;
TQMap<TDEIO::Job*, bool> openURL_reload;
TQMap<TQString,TQString> m_referenceURLMap;
};
/**
@ -191,7 +190,7 @@ public:
static bool exists();
private slots:
void slotFileDirty( const TQString &_file );
void slotFileDirty( const KURL &_url );
void slotFileCreated( const TQString &_file );
void slotFileDeleted( const TQString &_file );
@ -249,7 +248,7 @@ private:
if ( autoUpdates )
{
if ( KDirWatch::exists() && url.isLocalFile() )
kdirwatch->removeDir( url.path() );
kdirwatch->removeDir( url );
sendSignal( false, url );
}
delete rootItem;
@ -272,11 +271,11 @@ private:
if ( autoUpdates )
{
if ( url.isLocalFile() )
kdirwatch->removeDir( url.path() );
kdirwatch->removeDir( url );
sendSignal( false, url );
if ( newUrl.isLocalFile() )
kdirwatch->addDir( newUrl.path() );
kdirwatch->addDir( newUrl );
sendSignal( true, newUrl );
}
@ -291,7 +290,7 @@ private:
if ( autoUpdates++ == 0 )
{
if ( url.isLocalFile() )
kdirwatch->addDir( url.path() );
kdirwatch->addDir( url );
sendSignal( true, url );
}
}
@ -301,7 +300,7 @@ private:
if ( --autoUpdates == 0 )
{
if ( url.isLocalFile() )
kdirwatch->removeDir( url.path() );
kdirwatch->removeDir( url );
sendSignal( false, url );
}

@ -60,6 +60,7 @@
#include <tdeglobal.h>
#include <kstaticdeleter.h>
#include <kde_file.h>
#include <kurl.h>
// debug
#include <sys/ioctl.h>
@ -429,9 +430,9 @@ void KDirWatchPrivate::slotActivated()
kdDebug(7001) << "-->got deleteself signal for " << e->path << endl;
e->m_status = NonExistent;
if (e->isDir)
addEntry(0, TQDir::cleanDirPath(e->path+"/.."), e, true);
addEntry(0, TQDir::cleanDirPath(e->path.path()+"/.."), e, true);
else
addEntry(0, TQFileInfo(e->path).dirPath(true), e, true);
addEntry(0, TQFileInfo(e->path.path()).dirPath(true), e, true);
}
if ( event->mask & IN_IGNORED ) {
e->wd = 0;
@ -439,10 +440,10 @@ void KDirWatchPrivate::slotActivated()
if ( event->mask & (IN_CREATE|IN_MOVED_TO) ) {
Entry *sub_entry = e->m_entries.first();
for(;sub_entry; sub_entry = e->m_entries.next())
if (sub_entry->path == e->path + "/" + path) break;
if (sub_entry->path == e->path.path() + "/" + path) break;
if (sub_entry /*&& sub_entry->isDir*/) {
removeEntry(0,e->path, sub_entry);
removeEntry(0,e->path.path(), sub_entry);
KDE_struct_stat stat_buf;
TQCString tpath = TQFile::encodeName(path);
KDE_stat(tpath, &stat_buf);
@ -539,19 +540,19 @@ int KDirWatchPrivate::Entry::clients()
}
KDirWatchPrivate::Entry* KDirWatchPrivate::entry(const TQString& _path)
KDirWatchPrivate::Entry* KDirWatchPrivate::entry(const KURL& _path)
{
// we only support absolute paths
if (TQDir::isRelativePath(_path)) {
if (TQDir::isRelativePath(_path.path())) {
return 0;
}
TQString path = _path;
TQString path = _path.path();
if ( path.length() > 1 && path.right(1) == "/" )
path.truncate( path.length() - 1 );
EntryMap::Iterator it = m_mapEntries.find( path );
EntryMap::Iterator it = m_mapEntries.find( _path );
if ( it == m_mapEntries.end() )
return 0;
else
@ -588,10 +589,10 @@ bool KDirWatchPrivate::useFAM(Entry* e)
if (e->isDir) {
if (e->m_status == NonExistent) {
// If the directory does not exist we watch the parent directory
addEntry(0, TQDir::cleanDirPath(e->path+"/.."), e, true);
addEntry(0, TQDir::cleanDirPath(e->path.path()+"/.."), e, true);
}
else {
int res =FAMMonitorDirectory(&fc, TQFile::encodeName(e->path),
int res =FAMMonitorDirectory(&fc, TQFile::encodeName(e->path.path()),
&(e->fr), e);
if (res<0) {
e->m_mode = UnknownMode;
@ -600,16 +601,16 @@ bool KDirWatchPrivate::useFAM(Entry* e)
}
kdDebug(7001) << " Setup FAM (Req "
<< FAMREQUEST_GETREQNUM(&(e->fr))
<< ") for " << e->path << endl;
<< ") for " << e->path.path() << endl;
}
}
else {
if (e->m_status == NonExistent) {
// If the file does not exist we watch the directory
addEntry(0, TQFileInfo(e->path).dirPath(true), e, true);
addEntry(0, TQFileInfo(e->path.path()).dirPath(true), e, true);
}
else {
int res = FAMMonitorFile(&fc, TQFile::encodeName(e->path),
int res = FAMMonitorFile(&fc, TQFile::encodeName(e->path.path()),
&(e->fr), e);
if (res<0) {
e->m_mode = UnknownMode;
@ -619,7 +620,7 @@ bool KDirWatchPrivate::useFAM(Entry* e)
kdDebug(7001) << " Setup FAM (Req "
<< FAMREQUEST_GETREQNUM(&(e->fr))
<< ") for " << e->path << endl;
<< ") for " << e->path.path() << endl;
}
}
@ -644,7 +645,7 @@ bool KDirWatchPrivate::useDNotify(Entry* e)
if (e->isDir) {
if (e->m_status == Normal) {
int fd = KDE_open(TQFile::encodeName(e->path).data(), O_RDONLY);
int fd = KDE_open(TQFile::encodeName(e->path.path()).data(), O_RDONLY);
// Migrate fd to somewhere above 128. Some libraries have
// constructs like:
// fd = socket(...)
@ -688,16 +689,16 @@ bool KDirWatchPrivate::useDNotify(Entry* e)
e->dn_fd = fd;
kdDebug(7001) << " Setup DNotify (fd " << fd
<< ") for " << e->path << endl;
<< ") for " << e->path.path() << endl;
}
else { // NotExisting
addEntry(0, TQDir::cleanDirPath(e->path+"/.."), e, true);
addEntry(0, TQDir::cleanDirPath(e->path.path()+"/.."), e, true);
}
}
else { // File
// we always watch the directory (DNOTIFY can't watch files alone)
// this notifies us about changes of files therein
addEntry(0, TQFileInfo(e->path).dirPath(true), e, true);
addEntry(0, TQFileInfo(e->path.path()).dirPath(true), e, true);
}
return true;
@ -726,14 +727,14 @@ bool KDirWatchPrivate::useINotify( Entry* e )
}
if ( ( e->wd = inotify_add_watch( m_inotify_fd,
TQFile::encodeName( e->path ), mask) ) > 0 )
TQFile::encodeName( e->path.path() ), mask) ) > 0 )
return true;
if ( e->m_status == NonExistent ) {
if (e->isDir)
addEntry(0, TQDir::cleanDirPath(e->path+"/.."), e, true);
addEntry(0, TQDir::cleanDirPath(e->path.path()+"/.."), e, true);
else
addEntry(0, TQFileInfo(e->path).dirPath(true), e, true);
addEntry(0, TQFileInfo(e->path.path()).dirPath(true), e, true);
return true;
}
@ -743,8 +744,8 @@ bool KDirWatchPrivate::useINotify( Entry* e )
bool KDirWatchPrivate::useStat(Entry* e)
{
if ( e->path.startsWith("/media/") || (e->path == "/media")
|| (TDEIO::probably_slow_mounted(e->path)) )
if ( e->path.path().startsWith("/media/") || (e->path.path() == "/media")
|| (TDEIO::probably_slow_mounted(e->path.path())) )
useFreq(e, m_nfsPollInterval);
else
useFreq(e, m_PollInterval);
@ -761,7 +762,7 @@ bool KDirWatchPrivate::useStat(Entry* e)
}
kdDebug(7001) << " Setup Stat (freq " << e->freq
<< ") for " << e->path << endl;
<< ") for " << e->path.path() << endl;
return true;
}
@ -772,17 +773,17 @@ bool KDirWatchPrivate::useStat(Entry* e)
* Sometimes, entries are dependant on each other: if <sub_entry> !=0,
* this entry needs another entry to watch himself (when notExistent).
*/
void KDirWatchPrivate::addEntry(KDirWatch* instance, const TQString& _path,
void KDirWatchPrivate::addEntry(KDirWatch* instance, const KURL& _path,
Entry* sub_entry, bool isDir)
{
TQString path = _path;
TQString path = _path.path();
if (path.startsWith("/dev/") || (path == "/dev"))
return; // Don't even go there.
if ( path.length() > 1 && path.right(1) == "/" )
path.truncate( path.length() - 1 );
EntryMap::Iterator it = m_mapEntries.find( path );
EntryMap::Iterator it = m_mapEntries.find( _path );
if ( it != m_mapEntries.end() )
{
if (sub_entry) {
@ -820,7 +821,7 @@ void KDirWatchPrivate::addEntry(KDirWatch* instance, const TQString& _path,
mask |= IN_ONLYDIR;
inotify_rm_watch (m_inotify_fd, e->wd);
e->wd = inotify_add_watch( m_inotify_fd, TQFile::encodeName( e->path ), mask);
e->wd = inotify_add_watch( m_inotify_fd, TQFile::encodeName( e->path.path() ), mask);
}
}
#endif
@ -842,9 +843,9 @@ void KDirWatchPrivate::addEntry(KDirWatch* instance, const TQString& _path,
bool exists = (KDE_stat(tpath, &stat_buf) == 0);
Entry newEntry;
m_mapEntries.insert( path, newEntry );
m_mapEntries.insert( _path, newEntry );
// the insert does a copy, so we have to use <e> now
Entry* e = &(m_mapEntries[path]);
Entry* e = &(m_mapEntries[_path]);
if (exists) {
e->isDir = S_ISDIR(stat_buf.st_mode);
@ -867,7 +868,7 @@ void KDirWatchPrivate::addEntry(KDirWatch* instance, const TQString& _path,
e->m_nlink = 0;
}
e->path = path;
e->path = _path;
if (sub_entry)
e->m_entries.append(sub_entry);
else
@ -875,7 +876,7 @@ void KDirWatchPrivate::addEntry(KDirWatch* instance, const TQString& _path,
kdDebug(7001) << "Added " << (e->isDir ? "Dir ":"File ") << path
<< (e->m_status == NonExistent ? " NotExisting" : "")
<< (sub_entry ? TQString(TQString(" for %1").arg(sub_entry->path)) : TQString(""))
<< (sub_entry ? TQString(TQString(" for %1").arg(sub_entry->path.path())) : TQString(""))
<< (instance ? TQString(TQString(" [%1]").arg(instance->name())) : TQString(""))
<< endl;
@ -904,7 +905,7 @@ void KDirWatchPrivate::addEntry(KDirWatch* instance, const TQString& _path,
void KDirWatchPrivate::removeEntry( KDirWatch* instance,
const TQString& _path, Entry* sub_entry )
const KURL& _path, Entry* sub_entry )
{
kdDebug(7001) << "KDirWatchPrivate::removeEntry for '" << _path << "' sub_entry: " << sub_entry << endl;
Entry* e = entry(_path);
@ -919,7 +920,7 @@ void KDirWatchPrivate::removeEntry( KDirWatch* instance,
e->removeClient(instance);
if (e->m_clients.count() || e->m_entries.count()) {
kdDebug(7001) << "removeEntry: unwatched " << e->path << " " << _path << endl;
kdDebug(7001) << "removeEntry: unwatched " << e->path.path() << " " << _path << endl;
return;
}
@ -937,13 +938,13 @@ void KDirWatchPrivate::removeEntry( KDirWatch* instance,
FAMCancelMonitor(&fc, &(e->fr) );
kdDebug(7001) << "Cancelled FAM (Req "
<< FAMREQUEST_GETREQNUM(&(e->fr))
<< ") for " << e->path << endl;
<< ") for " << e->path.path() << endl;
}
else {
if (e->isDir)
removeEntry(0, TQDir::cleanDirPath(e->path+"/.."), e);
removeEntry(0, TQDir::cleanDirPath(e->path.path()+"/.."), e);
else
removeEntry(0, TQFileInfo(e->path).dirPath(true), e);
removeEntry(0, TQFileInfo(e->path.path()).dirPath(true), e);
}
}
#endif
@ -955,13 +956,13 @@ void KDirWatchPrivate::removeEntry( KDirWatch* instance,
(void) inotify_rm_watch( m_inotify_fd, e->wd );
kdDebug(7001) << "Cancelled INotify (fd " <<
m_inotify_fd << ", " << e->wd <<
") for " << e->path << endl;
") for " << e->path.path() << endl;
}
else {
if (e->isDir)
removeEntry(0, TQDir::cleanDirPath(e->path+"/.."), e);
removeEntry(0, TQDir::cleanDirPath(e->path.path()+"/.."), e);
else
removeEntry(0, TQFileInfo(e->path).dirPath(true), e);
removeEntry(0, TQFileInfo(e->path.path()).dirPath(true), e);
}
}
#endif
@ -969,7 +970,7 @@ void KDirWatchPrivate::removeEntry( KDirWatch* instance,
#ifdef HAVE_DNOTIFY
if (e->m_mode == DNotifyMode) {
if (!e->isDir) {
removeEntry(0, TQFileInfo(e->path).dirPath(true), e);
removeEntry(0, TQFileInfo(e->path.path()).dirPath(true), e);
}
else { // isDir
// must close the FD.
@ -979,13 +980,13 @@ void KDirWatchPrivate::removeEntry( KDirWatch* instance,
fd_Entry.remove(e->dn_fd);
kdDebug(7001) << "Cancelled DNotify (fd " << e->dn_fd
<< ") for " << e->path << endl;
<< ") for " << e->path.path() << endl;
e->dn_fd = 0;
}
}
else {
removeEntry(0, TQDir::cleanDirPath(e->path+"/.."), e);
removeEntry(0, TQDir::cleanDirPath(e->path.path()+"/.."), e);
}
}
}
@ -999,8 +1000,8 @@ void KDirWatchPrivate::removeEntry( KDirWatch* instance,
}
}
kdDebug(7001) << "Removed " << (e->isDir ? "Dir ":"File ") << e->path
<< (sub_entry ? TQString(TQString(" for %1").arg(sub_entry->path)) : TQString(""))
kdDebug(7001) << "Removed " << (e->isDir ? "Dir ":"File ") << e->path.path()
<< (sub_entry ? TQString(TQString(" for %1").arg(sub_entry->path.path())) : TQString(""))
<< (instance ? TQString(TQString(" [%1]").arg(instance->name())) : TQString(""))
<< endl;
m_mapEntries.remove( e->path ); // <e> not valid any more
@ -1052,7 +1053,7 @@ bool KDirWatchPrivate::stopEntryScan( KDirWatch* instance, Entry* e)
stillWatching += c->count;
}
kdDebug(7001) << instance->name() << " stopped scanning " << e->path
kdDebug(7001) << instance->name() << " stopped scanning " << e->path.path()
<< " (now " << stillWatching << " watchers)" << endl;
if (stillWatching == 0) {
@ -1082,7 +1083,7 @@ bool KDirWatchPrivate::restartEntryScan( KDirWatch* instance, Entry* e,
if (newWatching == 0)
return false;
kdDebug(7001) << (instance ? instance->name() : "all") << " restarted scanning " << e->path
kdDebug(7001) << (instance ? instance->name() : "all") << " restarted scanning " << e->path.path()
<< " (now " << wasWatching+newWatching << " watchers)" << endl;
// restart watching and emit pending events
@ -1091,7 +1092,7 @@ bool KDirWatchPrivate::restartEntryScan( KDirWatch* instance, Entry* e,
if (wasWatching == 0) {
if (!notify) {
KDE_struct_stat stat_buf;
bool exists = (KDE_stat(TQFile::encodeName(e->path), &stat_buf) == 0);
bool exists = (KDE_stat(TQFile::encodeName(e->path.path()), &stat_buf) == 0);
if (exists) {
e->m_ctime = stat_buf.st_ctime;
e->m_mtime = stat_buf.st_mtime;
@ -1170,7 +1171,7 @@ int KDirWatchPrivate::scanEntry(Entry* e)
if (e->m_mode == DNotifyMode || e->m_mode == INotifyMode ) {
// we know nothing has changed, no need to stat
if(!e->dirty) return NoChange;
kdDebug(7001) << "scanning " << e->path << " " << e->m_status << " " << e->m_ctime << " " << e->m_mtime << endl;
kdDebug(7001) << "scanning " << e->path.path() << " " << e->m_status << " " << e->m_ctime << " " << e->m_mtime << endl;
e->dirty = false;
}
#endif
@ -1186,7 +1187,7 @@ int KDirWatchPrivate::scanEntry(Entry* e)
}
KDE_struct_stat stat_buf;
bool exists = (KDE_stat(TQFile::encodeName(e->path), &stat_buf) == 0);
bool exists = (KDE_stat(TQFile::encodeName(e->path.path()), &stat_buf) == 0);
if (exists) {
if (e->m_status == NonExistent) {
@ -1232,18 +1233,18 @@ int KDirWatchPrivate::scanEntry(Entry* e)
* and stored pending events. When watching is stopped, the event is
* added to the pending events.
*/
void KDirWatchPrivate::emitEvent(Entry* e, int event, const TQString &fileName)
void KDirWatchPrivate::emitEvent(Entry* e, int event, const KURL &fileName)
{
TQString path = e->path;
TQString path = e->path.path();
if (!fileName.isEmpty()) {
if (!TQDir::isRelativePath(fileName))
path = fileName;
if (!TQDir::isRelativePath(fileName.path()))
path = fileName.path();
else
#ifdef Q_OS_UNIX
path += "/" + fileName;
path += "/" + fileName.path();
#elif defined(Q_WS_WIN)
//current drive is passed instead of /
path += TQDir::currentDirPath().left(2) + "/" + fileName;
path += TQDir::currentDirPath().left(2) + "/" + fileName.path();
#endif
}
@ -1279,8 +1280,10 @@ void KDirWatchPrivate::emitEvent(Entry* e, int event, const TQString &fileName)
// possible emit Change event after creation
}
if (event & Changed)
if (event & Changed) {
c->instance->setDirty(path);
c->instance->setDirty(e->path);
}
}
}
@ -1386,11 +1389,11 @@ void KDirWatchPrivate::slotRescan()
// Scan parent of deleted directories for new creation
Entry* e;
for(e=dList.first();e;e=dList.next())
addEntry(0, TQDir::cleanDirPath( e->path+"/.."), e, true);
addEntry(0, TQDir::cleanDirPath( e->path.path()+"/.."), e, true);
// Remove watch of parent of new created directories
for(e=cList.first();e;e=cList.next())
removeEntry(0, TQDir::cleanDirPath( e->path+"/.."), e);
removeEntry(0, TQDir::cleanDirPath( e->path.path()+"/.."), e);
#endif
if ( timerRunning )
@ -1492,7 +1495,7 @@ void KDirWatchPrivate::checkFAMEvent(FAMEvent* fe)
}
if (e->m_status == NonExistent) {
kdDebug(7001) << "FAM event for nonExistent entry " << e->path << endl;
kdDebug(7001) << "FAM event for nonExistent entry " << e->path.path() << endl;
return;
}
@ -1515,9 +1518,9 @@ void KDirWatchPrivate::checkFAMEvent(FAMEvent* fe)
FAMCancelMonitor(&fc, &(e->fr) ); // needed ?
kdDebug(7001) << "Cancelled FAMReq "
<< FAMREQUEST_GETREQNUM(&(e->fr))
<< " for " << e->path << endl;
<< " for " << e->path.path() << endl;
// Scan parent for a new creation
addEntry(0, TQDir::cleanDirPath( e->path+"/.."), e, true);
addEntry(0, TQDir::cleanDirPath( e->path.path()+"/.."), e, true);
}
break;
@ -1525,9 +1528,9 @@ void KDirWatchPrivate::checkFAMEvent(FAMEvent* fe)
// check for creation of a directory we have to watch
Entry *sub_entry = e->m_entries.first();
for(;sub_entry; sub_entry = e->m_entries.next())
if (sub_entry->path == e->path + "/" + fe->filename) break;
if (sub_entry->path.path() == e->path.path() + "/" + fe->filename) break;
if (sub_entry && sub_entry->isDir) {
TQString path = e->path;
KURL path = e->path;
removeEntry(0,e->path,sub_entry); // <e> can be invalid here!!
sub_entry->m_status = Normal;
if (!useFAM(sub_entry))
@ -1560,7 +1563,7 @@ void KDirWatchPrivate::statistics()
it = m_mapEntries.begin();
for( ; it != m_mapEntries.end(); ++it ) {
Entry* e = &(*it);
kdDebug(7001) << " " << e->path << " ("
kdDebug(7001) << " " << e->path.path() << " ("
<< ((e->m_status==Normal)?"":"Nonexistent ")
<< (e->isDir ? "Dir":"File") << ", using "
<< ((e->m_mode == FAMMode) ? "FAM" :
@ -1648,15 +1651,23 @@ KDirWatch::~KDirWatch()
// TODO: add watchFiles/recursive support
void KDirWatch::addDir( const TQString& _path,
bool watchFiles, bool recursive)
void KDirWatch::addDir( const TQString& _path, bool watchFiles, bool recursive)
{
if (watchFiles || recursive) {
kdDebug(7001) << "addDir - recursive/watchFiles not supported yet in KDE 3.x" << endl;
kdDebug(7001) << "addDir - recursive/watchFiles not supported yet in TDE 3.x" << endl;
}
if (d) d->addEntry(this, _path, 0, true);
}
// TODO: add watchFiles/recursive support
void KDirWatch::addDir( const KURL& _url, bool watchFiles, bool recursive)
{
if (watchFiles || recursive) {
kdDebug(7001) << "addDir - recursive/watchFiles not supported yet in TDE 3.x" << endl;
}
if (d) d->addEntry(this, _url, 0, true);
}
void KDirWatch::addFile( const TQString& _path )
{
if (d) d->addEntry(this, _path, 0, false);
@ -1679,6 +1690,11 @@ void KDirWatch::removeDir( const TQString& _path )
if (d) d->removeEntry(this, _path, 0);
}
void KDirWatch::removeDir( const KURL& _url )
{
if (d) d->removeEntry(this, _url, 0);
}
void KDirWatch::removeFile( const TQString& _path )
{
if (d) d->removeEntry(this, _path, 0);
@ -1752,6 +1768,12 @@ void KDirWatch::setDirty( const TQString & _file )
emit dirty( _file );
}
void KDirWatch::setDirty( const KURL & _url )
{
kdDebug(7001) << name() << " emitting dirty " << _url << endl;
emit dirty( _url );
}
void KDirWatch::setDeleted( const TQString & _file )
{
kdDebug(7001) << name() << " emitting deleted " << _file << endl;

@ -22,6 +22,8 @@
#include <tqdatetime.h>
#include <tqmap.h>
#include <kurl.h>
#include <tdelibs_export.h>
#define kdirwatch KDirWatch::self()
@ -96,8 +98,9 @@ class TDEIO_EXPORT KDirWatch : public TQObject
* @param watchFiles if true, the KDirWatch will also watch files - NOT IMPLEMENTED YET
* @param recursive if true, all sub directories are also watched - NOT IMPLEMENTED YET
*/
void addDir(const TQString& path,
bool watchFiles = false, bool recursive = false);
void addDir(const TQString& path, bool watchFiles = false, bool recursive = false);
void addDir(const KURL& url, bool watchFiles = false, bool recursive = false);
/**
* Adds a file to be watched.
@ -120,6 +123,8 @@ class TDEIO_EXPORT KDirWatch : public TQObject
*/
void removeDir(const TQString& path);
void removeDir(const KURL& path);
/**
* Removes a file from the list of watched files.
*
@ -212,6 +217,8 @@ class TDEIO_EXPORT KDirWatch : public TQObject
* @param path the path of the file or directory
*/
void setDirty( const TQString &path );
void setDirty( const KURL &url );
/**
* Emits deleted().
* @param path the path of the file or directory
@ -264,6 +271,8 @@ class TDEIO_EXPORT KDirWatch : public TQObject
*/
void dirty (const TQString &path);
void dirty (const KURL &url);
/**
* Emitted when a file or directory is created.
* @param path the path of the file or directory

@ -53,7 +53,7 @@ public:
TQPtrList<Client> m_clients;
// nonexistent entries of this directory
TQPtrList<Entry> m_entries;
TQString path;
KURL path;
int msecLeft, freq;
@ -77,15 +77,15 @@ public:
#endif
};
typedef TQMap<TQString,Entry> EntryMap;
typedef TQMap<KURL,Entry> EntryMap;
KDirWatchPrivate();
~KDirWatchPrivate();
void resetList (KDirWatch*,bool);
void useFreq(Entry* e, int newFreq);
void addEntry(KDirWatch*,const TQString&, Entry*, bool);
void removeEntry(KDirWatch*,const TQString&, Entry*);
void addEntry(KDirWatch*,const KURL&, Entry*, bool);
void removeEntry(KDirWatch*,const KURL&, Entry*);
bool stopEntryScan(KDirWatch*, Entry*);
bool restartEntryScan(KDirWatch*, Entry*, bool );
void stopScan(KDirWatch*);
@ -94,9 +94,9 @@ public:
void removeEntries(KDirWatch*);
void statistics();
Entry* entry(const TQString&);
Entry* entry(const KURL&);
int scanEntry(Entry* e);
void emitEvent(Entry* e, int event, const TQString &fileName = TQString::null);
void emitEvent(Entry* e, int event, const KURL &fileName = KURL());
// Memory management - delete when last KDirWatch gets deleted
void ref() { m_ref++; }

@ -262,8 +262,9 @@ void KFileItem::readUDSEntry( bool _urlIsDirectory )
// avoid creating these QStrings again and again
static const TQString& dot = TDEGlobal::staticQString(".");
if ( _urlIsDirectory && !UDS_URL_seen && !m_strName.isEmpty() && m_strName != dot )
if ( _urlIsDirectory && !UDS_URL_seen && !m_strName.isEmpty() && m_strName != dot ) {
m_url.addPath( m_strName );
}
}
void KFileItem::refresh()

Loading…
Cancel
Save