Introduce additional sorting / grouping options and actions for Konqueror Listviews (split from PR #196) #240
Merged
MicheleC
merged 1 commits from feature/konq-listview-enhancements
into master
2 years ago
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'feature/konq-listview-enhancements'
Deleting a branch is permanent. It CANNOT be undone. Continue?
New Konqueror listview options & actions, 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
WIP: Introduce additional sorting / grouping options and actions for Konqueror (split from PR #196)to WIP: Introduce additional sorting / grouping options and actions for Konqueror Listviews (split from PR #196) 2 years agoThanks @VinceR,
I will check this within the end of this week 😄
Please amend based on feedback below.
m_sortColumnOrderAlternate = config.alternateSortOrder();
if (m_sortColumnIndexPrimary >= 0 && m_sortColumnIndexAlternate >= 0)
if (m_sortColumnIndexPrimary != m_sortColumnIndexAlternate)
I don't think we need the second if (line 683). As long as two columns have been defined, it should be fine.
I was a little concerned about this but testing did not reveal a problem. I also removed a couple of pointless variable declarations at start of function.
if (m_sortColumnIndexPrimary >= 0 && m_sortColumnIndexAlternate >= 0)
if (m_sortColumnIndexPrimary != m_sortColumnIndexAlternate)
return ;
// FIXME: should we check other values?
Looks fine, we can remove FIXME comment (line 685)
{
friend class KonqBaseListViewWidget;
friend class ListViewBrowserExtension;
friend void KonqListViewItem::updateContents();
This (line 66) is not required, see comment on file konqueror/listview/konq_listviewitems.cpp.
friend class KonqBaseListViewWidget;
friend class ListViewBrowserExtension;
friend void KonqListViewItem::updateContents();
friend int KonqBaseListViewItem::compare(TQListViewItem* item, int col, bool ascending) const;
Line 67 (KonqBaseListViewItem::compare) not required for this PR.
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
line 5: original indentation is actually preferred.
sortChar = S_ISDIR( m_fileitem->mode() ) ? 1 : 3;
if ( m_fileitem->text()[0] == '.' )
--sortChar;
bool m_groupDirectoriesFirst = m_pListViewWidget->m_pBrowserView->m_pProps->isDirsFirst();
Please replace line 87-88 with
This avoids the need for the 'friend' in konqueror/listview/konq_listview.h:66
@VinceR
thanks for fixing up the points I had raised last week.
PR looks good now. Before merging, I will ask @SlavekB to have a look too, given it is a change in functionality and API too.
Code will go into R14.1.0 but not in R14.0.x most likely.
Looks good now.
It looks good, but there are some little things that would be good to do.
See comments below.
columnNumber = -1;
for (uint i=0; i<m_pListView->NumberOfAtoms; i++)
if (m_pListView->confColumns[i].displayInColumn==defaultVisibleColumn)
columnNumber=i;
Omitting parentheses in this section causes poor code readability.
Good catch, adding braces ({ }) will help. As well as adding spaces around < and == and =.
columnNumber=-1;
for (uint i=0; i<m_pListView->NumberOfAtoms; i++)
if (m_pListView->confColumns[i].displayInColumn==defaultVisibleColumn)
columnNumber=i;
Omitting parentheses in this section causes poor code readability.
Same as above about spaces and braces.
I got a bit confused about parentheses () versus braces {}. Is this what you are looking for:
... or is there another opportunity to introduce () that I missed?
(infer lost indentation in above example)
Yes, I meant braces –
{...}
. At least forfor
, but better it would also be forif
. You can look at code formatting style.Yes, I will look at that. I may have picked up some undesirable idioms from years of coding in Perl :)
Basically braces { } around both for and if bodies, allman style ({ on new line) and no space after ( and before )
m_iItemTextPos = config->readNumEntry( "ItemTextPos", TQIconView::Bottom );
d->sortcriterion = config->readEntry( "SortingCriterion", "sort_nci" );
d->dirsfirst = config->readBoolEntry( "SortDirsFirst", true );
d->dirsfirst = config->readBoolEntry( "GroupDirsFirst", true );
Because it changes the name of the configuration variable, here should be created kconf update file to automatically update the existing user configuration.
Good point, I missed that. I think there are a couple of easy solutions we can use.
do not change the config name, so keep "SortDirsFirst" instead of "GroupDirsFirst". As well as changing "GroupHiddenFirst" to "SortHiddenFirst". This is the easiest approach.
change the code to read original entry if the new one is not found
This will minimize the required changes. Personally I would go for option 1.
What do you think?
Somewhere along the line I changed the 'Sort' terminology to 'Group' because I figured that reverse sorting when SortDirsFirst is checked should imply that directories would sort last:)
But that's a quibble and since the Icon view feature came first, I will go with option 1 as you suggest.
Sounds good to me.
I initially meant to rename all "group" to "sort" in option 1. I could be picky and say that now the option says "SortDirsFirst" but the action name still says "Group &Directories First", but I guess no one will ever really look at the config file directly since those options can be enable from the Konqueror menu. If @SlavekB also agrees, we can keep the code as it is now.
Yes, it seems good that the configuration variables related to the sorting are consistently called Sort… and there is no problem that GUI items are named as it seems more concise Group….
The requested changes are simple but unfortunately I have run out of time (leaving on a trip). I need to postpone testing & committing for another week.
No worries Vince, take your time.
@VinceR
thanks. I was about the make the changes myself last Sunday but ultimately decided to wait one more week. And then you pushed the new commit a few hours later. Just nice! 😄
Everything seems to be fine.
You don't forget to do rebase to the current head and at the same time seems to be a good idea to make squash of all commit to one and omit comments Code modifications in response to request… 😸
@VinceR since your commits are not GPG signed, I will take care of squash and rebase. You will remain the author.
a53c3375b6
to9cd504156b
2 years agoWIP: Introduce additional sorting / grouping options and actions for Konqueror Listviews (split from PR #196)to Introduce additional sorting / grouping options and actions for Konqueror Listviews (split from PR #196) 2 years ago9cd504156b
into master 2 years ago@VinceR
I am glad we have finally merged the first part of the original PR #183!!
Well done and thanks for the valuable contribution.
As mentioned earlier, this will go into R14.1.0 but not R14.0.x due to the extensive changes involved.
Now we shall move on on the remaining dictionary sort part (see PR #196).
Thank you, MicheleC and SlavekB, for working with me on this PR. Should we continue dictionary (and version) sort with PR #196 or start a new PR?
We can continue discussion using PR #196 initially (I posted a comment yesterday) and at some point we will open a PR only for that.
@VinceR
it occoured to me that we didn't add documentation in the Konqueror's handbook about this new functionality. That would be very useful for users.
Would you be able to work on that at some point? Please use a new PR when you want to submit the changes.
Hi MicheleC,
I didn't see your message until today. I took a look at my Konqueror handbook only to find out I don't have one on my system (will have to research this) -- so I took a look at the XML docbook files in the source code to see what they say.
I think a whole section could be devoted to discussion of:
I'll try to put together a document of potential verbiage to add to handbook and submit it as a PR in the next month or so. We can discuss, then with your help, I can put together a docbook page.
Vince
Great thanks a lot. We can add that for R14.1.1 :-)
Reviewers
9cd504156b
.