Persist new sorting options as KonqPropsView settings.

Some code cleanup and debug message removal.
Quick test and validation of updated code.

Signed-off-by: Vincent Reher <tde@4reher.org>
pull/182/head
Vincent Reher 3 years ago
parent b605cad5ac
commit e6955a46f3

@ -16,7 +16,7 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#define DEBUG_SORTFUNCS
//-Not needed right now: define DEBUG_SORTFUNCS
#include "konq_listview.h"
#include "konq_textviewwidget.h"
#include "konq_treeviewwidget.h"
@ -553,7 +553,7 @@ void KonqListView::slotHeaderClicked(int sec)
/* Notes
* I think 'section' represents the left-to-right offset of a VISIBLE column
*
*
* I think this subroutine does not trigger any sorting by itself but rather
* is called AFTER the sort has already been done, maybe to ensure that
* the configuration file is updated!
@ -567,22 +567,22 @@ void KonqListView::slotHeaderClicked(int sec)
TQString nameOfSortColumn;
//we clicked the file name column
if (clickedColumn==-1)
nameOfSortColumn="FileName";
else
nameOfSortColumn="FileName";
else
nameOfSortColumn=m_pListView->confColumns[clickedColumn].desktopFileName;
*/
TQString nameOfSortColumn = DisplayColumn_Name(sec) ;
#ifdef DEBUG_SORTFUNCS
kdWarning()<<"section: "<<sec<<" clicked"<<endl;
#endif
if ( sec != SortColumnIndex_Alternate ) {
#ifdef DEBUG_SORTFUNCS
kdWarning()
<< "KonqListView::slotHeaderClicked - changed alternate sort column"
<< " FROM '" << SortColumnName_Alternate
<< " FROM '" << SortColumnName_Alternate
<< "' ( column " << SortColumnIndex_Alternate << " )" << endl
;
#endif
@ -593,7 +593,7 @@ void KonqListView::slotHeaderClicked(int sec)
#ifdef DEBUG_SORTFUNCS
kdWarning()
<< "KonqListView::slotHeaderClicked - changed alternate sort column"
<< "TO '" << SortColumnName_Alternate
<< "TO '" << SortColumnName_Alternate
<< "' ( column " << SortColumnIndex_Alternate << " )" << endl
;
#endif
@ -728,7 +728,7 @@ void KonqListView::SortListView(uint which)
// Do actual sorting and remember the order
m_pListView->sort();
m_pListView->setAscending(SortOrder);
m_pListView->setAscending(SortOrder) ;
}
void KonqListView::slotSortAlternate()
@ -748,26 +748,26 @@ void KonqListView::slotSortReverse()
void KonqListView::slot_Toggle_Display_Directories_1st()
{
Display_Directories_1st = !Display_Directories_1st ;
m_pProps->setDirsFirst( Display_Directories_1st );
// Not yet sure is this is the right place to store this setting
// See TO-DO. We decided to "borrow" this property that had been
// previously defined for konq_iconview.
// Property had been previously implemented only in konq_iconview.
m_pListView->updateListContents();
// Calls updateContents() for EACH list item, modifying its sorChar
m_pListView->sort();
}
void KonqListView::slot_Toggle_Display_Hidden_1st()
{
Display_Hidden_1st = !Display_Hidden_1st ;
m_pProps->setHiddenFirst( Display_Hidden_1st );
m_pListView->updateListContents();
// Calls updateContents() for EACH list item, modifying its sorChar
m_pListView->sort();
}
void KonqListView::slot_Toggle_Sort_DictionaryOrder()
{
Sort_Dictionary_Order = !Sort_Dictionary_Order ;
m_pProps->setDictionaryOrder( Sort_Dictionary_Order );
m_pListView->sort();
}

@ -189,7 +189,7 @@ private:
//--------------------------------------------------------------------
// User action-response handlers
TDEToggleAction *m_paDisplay_Directories_1st;
// triggers slot_Toggle_Display_Directories_1st()
TDEToggleAction *m_paDisplay_Hidden_1st;

@ -78,8 +78,6 @@ KonqListViewItem::~KonqListViewItem()
void KonqListViewItem::updateContents()
{
bool mysetting = m_pListViewWidget->m_pBrowserView->Display_Directories_1st ;
// Set the pixmap
setDisabled( m_bDisabled );

@ -67,6 +67,14 @@ struct KonqPropsView::Private
TQStringList* previewsToShow;
bool previewsEnabled:1;
bool caseInsensitiveSort:1;
//---------------------------------------------------------------------------
//--- Begin: listview sorting enhancements II
//---------------------------------------------------------------------------
bool dictionaryorder:1;
bool hiddenfirst:1;
//---------------------------------------------------------------------------
//--- End: listview sorting enhancements II
//---------------------------------------------------------------------------
bool dirsfirst:1;
bool descending:1;
TQString sortcriterion;
@ -91,6 +99,14 @@ 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 );
//----------------------------------------------------------------------------
//--- Begin: listview sorting enhancements II
//----------------------------------------------------------------------------
d->hiddenfirst = config->readBoolEntry( "SortHiddenFirst", true );
d->dictionaryorder = config->readBoolEntry( "SortDictionaryOrder", false );
//----------------------------------------------------------------------------
//--- End: listview sorting enhancements II
//----------------------------------------------------------------------------
d->descending = config->readBoolEntry( "SortDescending", false );
m_bShowDot = config->readBoolEntry( "ShowDotFiles", false );
m_bShowDirectoryOverlays = config->readBoolEntry( "ShowDirectoryOverlays", false );
@ -143,6 +159,22 @@ bool KonqPropsView::isDirsFirst() const
return d->dirsfirst;
}
//------------------------------------------------------------------------------
//--- Begin: listview sorting enhancements II
//------------------------------------------------------------------------------
bool KonqPropsView::isHiddenFirst() const
{
return d->hiddenfirst;
}
bool KonqPropsView::isDictionaryOrder() const
{
return d->dictionaryorder;
}
//------------------------------------------------------------------------------
//--- End: listview sorting enhancements II
//------------------------------------------------------------------------------
bool KonqPropsView::isDescending() const
{
return d->descending;
@ -328,6 +360,38 @@ void KonqPropsView::setDirsFirst( bool first)
}
}
//------------------------------------------------------------------------------
//--- Begin: listview sorting enhancements II
//------------------------------------------------------------------------------
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::setDictionaryOrder( bool first)
{
d->dictionaryorder = first;
if ( m_defaultProps && !m_bSaveViewPropertiesLocally )
m_defaultProps->setDictionaryOrder( first );
else if (currentConfig())
{
TDEConfigGroupSaver cgs(currentConfig(), currentGroup());
currentConfig()->writeEntry( "SortDictionaryOrder", d->dictionaryorder );
currentConfig()->sync();
}
}
//------------------------------------------------------------------------------
//--- End: listview sorting enhancements II
//------------------------------------------------------------------------------
void KonqPropsView::setDescending( bool descend)
{
d->descending = descend;

@ -93,6 +93,18 @@ public:
void setDirsFirst ( bool first );
bool isDirsFirst() const;
//----------------------------------------------------------------------------
//--- Begin: listview sorting enhancements II
//----------------------------------------------------------------------------
void setHiddenFirst ( bool first );
bool isHiddenFirst() const;
void setDictionaryOrder ( bool first );
bool isDictionaryOrder() const;
//----------------------------------------------------------------------------
//--- End: listview sorting enhancements II
//----------------------------------------------------------------------------
void setDescending (bool descending);
bool isDescending() const;

Loading…
Cancel
Save