Implemented better fallback when konqlistviewrc/[Settings]/hiddenFileSpec

key does not exist

Implemented more comprehensive response to user-caused changes to
hidden file match criteria

Signed-off-by: Vincent Reher <tde@4reher.org>
issue/270/tdebase
Vincent Reher 2 years ago
parent 1ecedf73b2
commit 53ee298ff7

@ -273,7 +273,10 @@ KonqListView::KonqListView( TQWidget *parentWidget, TQObject *parent, const char
m_sortColumnIndexPrimary = 0; m_sortColumnIndexPrimary = 0;
m_sortColumnIndexAlternate = 1; m_sortColumnIndexAlternate = 1;
m_pListView->m_dirLister->matcher->setCriteria( m_pProps->hiddenFileSpec() ); TQString hiddenFileSpec = m_pProps->hiddenFileSpec() ;
if ( ! hiddenFileSpec.isNull() ) {
m_pListView->m_dirLister->matcher->setCriteria( hiddenFileSpec );
} // otherwise we rely on matcher's default criteria
setupActions(); setupActions();
@ -481,31 +484,57 @@ void KonqListView::newIconSize( int size )
void KonqListView::slotChangeHiddenFileMatcher() void KonqListView::slotChangeHiddenFileMatcher()
{ {
/* bool wasShowingHidden = m_paShowDot->isChecked();
Since the user might be providing *updated* hidden file match properties, if ( ! wasShowingHidden ) {
we first need to make sure that we are showing (not hiding) "hidden" files /*
as defined by the *current* match properties. Otherwise there can be Since the user might be providing *updated* hidden file match properties,
a lot of confusion! we first need to make sure that we are showing (not hiding) "hidden" files
*/ as defined by the *current* match properties. Otherwise there can be
m_paShowDot->setChecked( TRUE ); a lot of confusion!
slotShowDot(); */
m_paShowDot->setChecked( TRUE );
int result = m_pListView->m_dirLister->matcher->getMatchPropertiesFromUser() ; slotShowDot();
}
int result = m_pListView->m_dirLister->matcher->getMatchPropertiesFromUser( "Konqueror Listview" ) ;
switch ( result ) { switch ( result ) {
case TDEIO::HiddenFileMatcher::criteriaUnchanged: case TDEIO::HiddenFileMatcher::criteriaUnchanged:
if ( ! wasShowingHidden ) {
m_paShowDot->setChecked( FALSE );
slotShowDot();
}
return; return;
break; break;
case TDEIO::HiddenFileMatcher::criteriaApplied: case TDEIO::HiddenFileMatcher::criteriaApplied:
return; // On-the-fly change
break; break;
case TDEIO::HiddenFileMatcher::saveCriteria: case TDEIO::HiddenFileMatcher::saveCriteria:
m_pProps->setHiddenFileSpec( m_pListView->m_dirLister->matcher->getCriteria() ); m_pProps->setHiddenFileSpec( m_pListView->m_dirLister->matcher->getCriteria() );
break; break;
case TDEIO::HiddenFileMatcher::reloadCriteria: case TDEIO::HiddenFileMatcher::reloadCriteria:
m_pListView->m_dirLister->matcher->setCriteria( m_pProps->hiddenFileSpec() ); TQString hiddenFileSpec = m_pProps->hiddenFileSpec() ;
if ( ! hiddenFileSpec.isNull() ) {
// Reload from current listview setting
m_pListView->m_dirLister->matcher->setCriteria( hiddenFileSpec );
}
else {
// Reload from current systemwide default setting
TDEIO::HiddenFileMatcher *commonMatcher = TDEIO::CommonHiddenFileMatcher::getMatcher();
m_pListView->m_dirLister->matcher->setCriteria( commonMatcher->getCriteria() );
}
break; break;
} }
// Hidden file match properties WERE changed, so we need to
// ensure that these UI view options continue to work properly:
// "Group Hidden First" sort option
slotToggleDisplayHiddenFirst();
// "Show Hidden Files" option
m_paShowDot->setChecked( wasShowingHidden );
slotShowDot(); //
} }
void KonqListView::slotShowDot() void KonqListView::slotShowDot()

@ -96,9 +96,8 @@ void KonqListViewItem::updateContents()
sortChar = S_ISDIR( m_fileitem->mode() ) ? 1 : 3; sortChar = S_ISDIR( m_fileitem->mode() ) ? 1 : 3;
else else
sortChar = 3; sortChar = 3;
if ( m_groupHiddenFirst && m_pListViewWidget->m_dirLister->matcher->match( m_fileitem->text() ) ) if ( m_fileitem->isHidden( m_pListViewWidget->m_dirLister->matcher ) )
--sortChar; --sortChar;
//now we have the first column, so let's do the rest //now we have the first column, so let's do the rest

@ -99,7 +99,7 @@ KonqPropsView::KonqPropsView( TDEInstance * instance, KonqPropsView * defaultPro
d->dirsfirst = config->readBoolEntry( "SortDirsFirst", true ); d->dirsfirst = config->readBoolEntry( "SortDirsFirst", true );
d->hiddenfirst = config->readBoolEntry( "SortHiddenFirst", true ); d->hiddenfirst = config->readBoolEntry( "SortHiddenFirst", true );
d->descending = config->readBoolEntry( "SortDescending", false ); d->descending = config->readBoolEntry( "SortDescending", false );
d->hiddenfilecriteria = config->readEntry( "HiddenFileSpec", "w.*" ); // default is wildcard for dotfiles d->hiddenfilecriteria = config->readEntry( "HiddenFileSpec" ); // need fallback to be TQString::null
m_bShowDot = config->readBoolEntry( "ShowDotFiles", false ); m_bShowDot = config->readBoolEntry( "ShowDotFiles", false );
m_bShowDirectoryOverlays = config->readBoolEntry( "ShowDirectoryOverlays", false ); m_bShowDirectoryOverlays = config->readBoolEntry( "ShowDirectoryOverlays", false );
m_bShowFreeSpaceOverlays = config->readBoolEntry( "ShowFreeSpaceOverlays", true ); m_bShowFreeSpaceOverlays = config->readBoolEntry( "ShowFreeSpaceOverlays", true );

Loading…
Cancel
Save