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