summaryrefslogtreecommitdiffstats
path: root/libkonq
diff options
context:
space:
mode:
authorVincent Reher <tde@4reher.org>2021-11-02 09:11:34 -0700
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-12-17 21:45:37 +0900
commit9cd504156b4fff688cd427af7244f6522f2e5da8 (patch)
treed514e92ec9441bca8b84aa31a1ee293a31d07186 /libkonq
parent76fe6863ce1338d0e1dd0a9bc84630187a21ed11 (diff)
downloadtdebase-9cd504156b4fff688cd427af7244f6522f2e5da8.tar.gz
tdebase-9cd504156b4fff688cd427af7244f6522f2e5da8.zip
Introduce additional sorting / grouping options and actions for Konqueror
listviews, available through new submenu: View => Sort Options: (1) "Group Directories First" - Toggle on/off option to group directories before non-directories. Comparable to iconview's "Folders First" option. (2) "Group Hidden First" - Toggle on/off option to group hidden entities (aka dotfiles) before non-hidden. Option-related settings are stored in config/konqlistviewrc Actions: (1) "Reverse Sort Order" - Toggle sort order of the current sort column. Action bound to key Ctrl+R. (2) "Alternate Sort Order" - Toggle sorting between 2 most recent sort columns selected by mouse click. The existing sort order for the sort columns is preserved. Action bound to key Ctrl+S. Action-related settings are stored in config/konquerorrc/[Listview_file] Signed-off-by: Vincent Reher <tde@4reher.org> Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'libkonq')
-rw-r--r--libkonq/konq_propsview.cpp22
-rw-r--r--libkonq/konq_propsview.h3
2 files changed, 25 insertions, 0 deletions
diff --git a/libkonq/konq_propsview.cpp b/libkonq/konq_propsview.cpp
index f9a69b8f6..af7a65eae 100644
--- a/libkonq/konq_propsview.cpp
+++ b/libkonq/konq_propsview.cpp
@@ -67,6 +67,7 @@ struct KonqPropsView::Private
TQStringList* previewsToShow;
bool previewsEnabled:1;
bool caseInsensitiveSort:1;
+ bool hiddenfirst:1;
bool dirsfirst:1;
bool descending:1;
TQString sortcriterion;
@@ -91,6 +92,7 @@ KonqPropsView::KonqPropsView( TDEInstance * instance, KonqPropsView * defaultPro
m_iItemTextPos = config->readNumEntry( "ItemTextPos", TQIconView::Bottom );
d->sortcriterion = config->readEntry( "SortingCriterion", "sort_nci" );
d->dirsfirst = config->readBoolEntry( "SortDirsFirst", true );
+ d->hiddenfirst = config->readBoolEntry( "SortHiddenFirst", true );
d->descending = config->readBoolEntry( "SortDescending", false );
m_bShowDot = config->readBoolEntry( "ShowDotFiles", false );
m_bShowDirectoryOverlays = config->readBoolEntry( "ShowDirectoryOverlays", false );
@@ -143,6 +145,11 @@ bool KonqPropsView::isDirsFirst() const
return d->dirsfirst;
}
+bool KonqPropsView::isHiddenFirst() const
+{
+ return d->hiddenfirst;
+}
+
bool KonqPropsView::isDescending() const
{
return d->descending;
@@ -200,6 +207,7 @@ bool KonqPropsView::enterDir( const KURL & dir )
m_iItemTextPos = m_defaultProps->itemTextPos();
d->sortcriterion = m_defaultProps->sortCriterion();
d->dirsfirst = m_defaultProps->isDirsFirst();
+ d->hiddenfirst = m_defaultProps->isHiddenFirst();
d->descending = m_defaultProps->isDescending();
m_bShowDot = m_defaultProps->isShowingDotFiles();
d->caseInsensitiveSort=m_defaultProps->isCaseInsensitiveSort();
@@ -219,6 +227,7 @@ bool KonqPropsView::enterDir( const KURL & dir )
m_iItemTextPos = config->readNumEntry( "ItemTextPos", m_iItemTextPos );
d->sortcriterion = config->readEntry( "SortingCriterion" , d->sortcriterion );
d->dirsfirst = config->readBoolEntry( "SortDirsFirst", d->dirsfirst );
+ d->hiddenfirst = config->readBoolEntry( "SortHiddenFirst", d->hiddenfirst );
d->descending = config->readBoolEntry( "SortDescending", d->descending );
m_bShowDot = config->readBoolEntry( "ShowDotFiles", m_bShowDot );
d->caseInsensitiveSort=config->readBoolEntry("CaseInsensitiveSort",d->caseInsensitiveSort);
@@ -328,6 +337,19 @@ void KonqPropsView::setDirsFirst( bool first)
}
}
+void KonqPropsView::setHiddenFirst(bool first)
+{
+ d->hiddenfirst = first;
+ if ( m_defaultProps && !m_bSaveViewPropertiesLocally )
+ m_defaultProps->setHiddenFirst( first );
+ else if (currentConfig())
+ {
+ TDEConfigGroupSaver cgs(currentConfig(), currentGroup());
+ currentConfig()->writeEntry( "SortHiddenFirst", d->hiddenfirst );
+ currentConfig()->sync();
+ }
+}
+
void KonqPropsView::setDescending( bool descend)
{
d->descending = descend;
diff --git a/libkonq/konq_propsview.h b/libkonq/konq_propsview.h
index 73d8b8e6d..84ffcf029 100644
--- a/libkonq/konq_propsview.h
+++ b/libkonq/konq_propsview.h
@@ -93,6 +93,9 @@ public:
void setDirsFirst ( bool first );
bool isDirsFirst() const;
+ void setHiddenFirst ( bool first );
+ bool isHiddenFirst() const;
+
void setDescending (bool descending);
bool isDescending() const;