summaryrefslogtreecommitdiffstats
path: root/konqueror/listview/konq_listviewitems.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'konqueror/listview/konq_listviewitems.cpp')
-rw-r--r--konqueror/listview/konq_listviewitems.cpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/konqueror/listview/konq_listviewitems.cpp b/konqueror/listview/konq_listviewitems.cpp
index 45ff99c1c..3910095f9 100644
--- a/konqueror/listview/konq_listviewitems.cpp
+++ b/konqueror/listview/konq_listviewitems.cpp
@@ -19,6 +19,7 @@
#include "konq_listview.h"
#include <konq_settings.h>
+#include "konq_string_compare.h"
#include <kdebug.h>
#include <tdelocale.h>
#include <assert.h>
@@ -84,10 +85,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
@@ -152,7 +161,7 @@ void KonqListViewItem::updateContents()
const TQString entryStr = retrieveExtraEntry( m_fileitem, numExtra );
if ( tmpColumn->type == TQVariant::DateTime )
{
- TQDateTime dt = TQT_TQDATETIME_OBJECT(TQDateTime::fromString( entryStr, Qt::ISODate ));
+ TQDateTime dt = TQDateTime::fromString( entryStr, TQt::ISODate );
setText(tmpColumn->displayInColumn,
TDEGlobal::locale()->formatDateTime(dt));
}
@@ -283,9 +292,9 @@ int KonqBaseListViewItem::compare( TQListViewItem* item, int col, bool ascending
{
if ( cInfo->type & TQVariant::DateTime ) {
const TQString entryStr1 = retrieveExtraEntry( m_fileitem, numExtra );
- TQDateTime dt1 = TQT_TQDATETIME_OBJECT(TQDateTime::fromString( entryStr1, Qt::ISODate ));
+ TQDateTime dt1 = TQDateTime::fromString( entryStr1, TQt::ISODate );
const TQString entryStr2 = retrieveExtraEntry( k->m_fileitem, numExtra );
- TQDateTime dt2 = TQT_TQDATETIME_OBJECT(TQDateTime::fromString( entryStr2, Qt::ISODate ));
+ TQDateTime dt2 = TQDateTime::fromString( entryStr2, TQt::ISODate );
return ( dt1 > dt2 ) ? 1 : ( dt1 < dt2 ) ? -1 : 0;
}
}
@@ -295,11 +304,10 @@ int KonqBaseListViewItem::compare( TQListViewItem* item, int col, bool ascending
break;
}
}
- if ( m_pListViewWidget->caseInsensitiveSort() )
- return text( col ).lower().localeAwareCompare( k->text( col ).lower() );
- else {
- return m_pListViewWidget->m_pSettings->caseSensitiveCompare( text( col ), k->text( col ) );
- }
+
+ /* If we reach here, we are comparing text columns (e.g file name). */
+
+ return stringCompare( m_pListViewWidget->m_sortOrder, text( col ), k->text( col ) );
}
void KonqListViewItem::paintCell( TQPainter *_painter, const TQColorGroup & _cg, int _column, int _width, int _alignment )
@@ -314,7 +322,7 @@ void KonqListViewItem::paintCell( TQPainter *_painter, const TQColorGroup & _cg,
cg.setColor( TQColorGroup::Text, m_pListViewWidget->itemColor() );
TDEListView *lv = static_cast< TDEListView* >( listView() );
- const TQPixmap *pm = TQT_TQPIXMAP_CONST(lv->viewport()->paletteBackgroundPixmap());
+ const TQPixmap *pm = lv->viewport()->paletteBackgroundPixmap();
if ( _column == 0 && isSelected() && !lv->allColumnsShowFocus() )
{
int newWidth = width( lv->fontMetrics(), lv, _column );