diff options
author | Vincent Reher <tde@4reher.org> | 2022-08-13 09:48:46 -0700 |
---|---|---|
committer | Vincent Reher <tde@4reher.org> | 2023-10-03 09:05:14 -0700 |
commit | 53ee298ff7d9427cee30fd1d0e89270168ef3813 (patch) | |
tree | b35106e4d0fb76308573c42309de6dc884407265 /konqueror | |
parent | 1ecedf73b2c24d1557c6d3d2753ca13be7547aee (diff) | |
download | tdebase-53ee298ff7d9427cee30fd1d0e89270168ef3813.tar.gz tdebase-53ee298ff7d9427cee30fd1d0e89270168ef3813.zip |
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>
Diffstat (limited to 'konqueror')
-rw-r--r-- | konqueror/listview/konq_listview.cpp | 55 | ||||
-rw-r--r-- | konqueror/listview/konq_listviewitems.cpp | 5 |
2 files changed, 44 insertions, 16 deletions
diff --git a/konqueror/listview/konq_listview.cpp b/konqueror/listview/konq_listview.cpp index 6752dbac1..a611c388d 100644 --- a/konqueror/listview/konq_listview.cpp +++ b/konqueror/listview/konq_listview.cpp @@ -273,7 +273,10 @@ KonqListView::KonqListView( TQWidget *parentWidget, TQObject *parent, const char m_sortColumnIndexPrimary = 0; 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(); @@ -481,31 +484,57 @@ void KonqListView::newIconSize( int size ) void KonqListView::slotChangeHiddenFileMatcher() { - /* - Since the user might be providing *updated* hidden file match properties, - 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 - a lot of confusion! - */ - m_paShowDot->setChecked( TRUE ); - slotShowDot(); - - int result = m_pListView->m_dirLister->matcher->getMatchPropertiesFromUser() ; + bool wasShowingHidden = m_paShowDot->isChecked(); + if ( ! wasShowingHidden ) { + /* + Since the user might be providing *updated* hidden file match properties, + 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 + a lot of confusion! + */ + m_paShowDot->setChecked( TRUE ); + slotShowDot(); + } + int result = m_pListView->m_dirLister->matcher->getMatchPropertiesFromUser( "Konqueror Listview" ) ; switch ( result ) { case TDEIO::HiddenFileMatcher::criteriaUnchanged: + if ( ! wasShowingHidden ) { + m_paShowDot->setChecked( FALSE ); + slotShowDot(); + } return; break; case TDEIO::HiddenFileMatcher::criteriaApplied: - return; + // On-the-fly change break; case TDEIO::HiddenFileMatcher::saveCriteria: m_pProps->setHiddenFileSpec( m_pListView->m_dirLister->matcher->getCriteria() ); break; 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; } + + // 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() diff --git a/konqueror/listview/konq_listviewitems.cpp b/konqueror/listview/konq_listviewitems.cpp index ae6a5ca4f..5b9ef230f 100644 --- a/konqueror/listview/konq_listviewitems.cpp +++ b/konqueror/listview/konq_listviewitems.cpp @@ -96,9 +96,8 @@ void KonqListViewItem::updateContents() sortChar = S_ISDIR( m_fileitem->mode() ) ? 1 : 3; else sortChar = 3; - if ( m_groupHiddenFirst && m_pListViewWidget->m_dirLister->matcher->match( m_fileitem->text() ) ) - --sortChar; - + if ( m_fileitem->isHidden( m_pListViewWidget->m_dirLister->matcher ) ) + --sortChar; //now we have the first column, so let's do the rest |