summaryrefslogtreecommitdiffstats
path: root/konqueror/listview/konq_listviewitems.cpp
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 /konqueror/listview/konq_listviewitems.cpp
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 'konqueror/listview/konq_listviewitems.cpp')
-rw-r--r--konqueror/listview/konq_listviewitems.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/konqueror/listview/konq_listviewitems.cpp b/konqueror/listview/konq_listviewitems.cpp
index 45ff99c1c..cf4322ef0 100644
--- a/konqueror/listview/konq_listviewitems.cpp
+++ b/konqueror/listview/konq_listviewitems.cpp
@@ -84,10 +84,18 @@ void KonqListViewItem::updateContents()
// Set the text of each column
setText( 0, m_fileitem->text() );
- // The order is: .dir (0), dir (1), .file (2), file (3)
- sortChar = S_ISDIR( m_fileitem->mode() ) ? 1 : 3;
- if ( m_fileitem->text()[0] == '.' )
- --sortChar;
+ bool m_groupDirectoriesFirst = m_pListViewWidget->props()->isDirsFirst();
+ bool m_groupHiddenFirst = m_pListViewWidget->props()->isHiddenFirst();
+
+ // The default TDE order is: .dir (0), dir (1), .file (2), file (3)
+
+ if ( m_groupDirectoriesFirst )
+ sortChar = S_ISDIR( m_fileitem->mode() ) ? 1 : 3;
+ else
+ sortChar = 3;
+
+ if ( m_groupHiddenFirst && m_fileitem->text()[0] == '.' )
+ --sortChar;
//now we have the first column, so let's do the rest