|
|
|
@ -1907,15 +1907,19 @@ void KDirListerCache::printDebug()
|
|
|
|
|
KDirLister::KDirLister( bool _delayedMimeTypes )
|
|
|
|
|
{
|
|
|
|
|
kdDebug(7003) << "+KDirLister" << endl;
|
|
|
|
|
|
|
|
|
|
d = new KDirListerPrivate;
|
|
|
|
|
|
|
|
|
|
// Create a separate "copy" of the global hidden file matcher
|
|
|
|
|
TSMTRACE << "KDirLister::KDirLister: Allocating a hidden file matcher" << endl;
|
|
|
|
|
d->hiddenFileMatcher = new TDEStringMatcher;
|
|
|
|
|
d->hiddenFileMatcher->setMatchSpecs( TDEGlobal::hiddenFileMatcher()->getMatchSpecString() );
|
|
|
|
|
|
|
|
|
|
d->complete = true;
|
|
|
|
|
d->delayedMimeTypes = _delayedMimeTypes;
|
|
|
|
|
|
|
|
|
|
setAutoUpdate( true );
|
|
|
|
|
setDirOnlyMode( false );
|
|
|
|
|
setShowingDotFiles( false );
|
|
|
|
|
setShowingHiddenFiles( false );
|
|
|
|
|
|
|
|
|
|
setAutoErrorHandlingEnabled( true, 0 );
|
|
|
|
|
}
|
|
|
|
@ -1931,6 +1935,7 @@ KDirLister::~KDirLister()
|
|
|
|
|
s_pCache->forgetDirs( this );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
delete d->hiddenFileMatcher;
|
|
|
|
|
delete d;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2015,18 +2020,28 @@ void KDirLister::setAutoUpdate( bool _enable )
|
|
|
|
|
s_pCache->setAutoUpdate( this, _enable );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool KDirLister::showingDotFiles() const
|
|
|
|
|
bool KDirLister::isShowingHiddenFiles() const
|
|
|
|
|
{
|
|
|
|
|
return d->isShowingDotFiles;
|
|
|
|
|
return d->isShowingHiddenFiles;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KDirLister::setShowingDotFiles( bool _showDotFiles )
|
|
|
|
|
void KDirLister::setShowingHiddenFiles( bool _showHiddenFiles )
|
|
|
|
|
{
|
|
|
|
|
if ( d->isShowingDotFiles == _showDotFiles )
|
|
|
|
|
if ( d->isShowingHiddenFiles == _showHiddenFiles )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
d->isShowingDotFiles = _showDotFiles;
|
|
|
|
|
d->changes ^= DOT_FILES;
|
|
|
|
|
d->isShowingHiddenFiles = _showHiddenFiles;
|
|
|
|
|
d->changes ^= HIDDEN_FILES;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool KDirLister::showingDotFiles() const
|
|
|
|
|
{
|
|
|
|
|
return isShowingHiddenFiles();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KDirLister::setShowingDotFiles( bool _showDotFiles )
|
|
|
|
|
{
|
|
|
|
|
setShowingHiddenFiles( _showDotFiles );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool KDirLister::dirOnlyMode() const
|
|
|
|
@ -2114,10 +2129,11 @@ void KDirLister::emitChanges()
|
|
|
|
|
|
|
|
|
|
if ( (*kit)->isHidden() )
|
|
|
|
|
{
|
|
|
|
|
if ( d->changes & DOT_FILES )
|
|
|
|
|
if ( d->changes & HIDDEN_FILES )
|
|
|
|
|
{
|
|
|
|
|
// the lister switched to dot files mode
|
|
|
|
|
if ( d->isShowingDotFiles ) {
|
|
|
|
|
// the lister switched to hidden files mode
|
|
|
|
|
if ( d->isShowingHiddenFiles ) {
|
|
|
|
|
|
|
|
|
|
addNewItem( *kit );
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
@ -2190,6 +2206,10 @@ KFileItem *KDirLister::find( const KURL& _url ) const
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
TDEStringMatcher *KDirLister::hiddenFileMatcher()
|
|
|
|
|
{
|
|
|
|
|
return d->hiddenFileMatcher;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ================ public filter methods ================ //
|
|
|
|
|
|
|
|
|
@ -2280,7 +2300,7 @@ bool KDirLister::matchesFilter( const KFileItem *item ) const
|
|
|
|
|
if ( item->text() == dotdot )
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if ( !d->isShowingDotFiles && item->isHidden() )
|
|
|
|
|
if ( !d->isShowingHiddenFiles && item->isHidden() )
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if ( item->isDir() || d->lstFilters.isEmpty() )
|
|
|
|
@ -2371,6 +2391,10 @@ void KDirLister::addNewItem( const KFileItem *item )
|
|
|
|
|
const_cast<KFileItem*>(item)->setURL(newItemURL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Replace KFileItem default hidden file matcher with our own.
|
|
|
|
|
//-Debug: TSMTRACE << "KDirLister::addNewItem() installing custom matcher for " << item->url().fileName() <<endl ;
|
|
|
|
|
const_cast<KFileItem*>(item)->setHiddenFileMatcher( d->hiddenFileMatcher );
|
|
|
|
|
|
|
|
|
|
if ( ( d->dirOnlyMode && !item->isDir() ) || !matchesFilter( item ) ) {
|
|
|
|
|
return; // No reason to continue... bailing out here prevents a mimetype scan.
|
|
|
|
|
}
|
|
|
|
|