diff options
author | Vincent Reher <tde@4reher.org> | 2022-03-05 15:14:32 -0800 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2022-07-02 16:02:09 +0900 |
commit | d4e06b76962198eb64e6c2826d4695248102037c (patch) | |
tree | 2ab32e02df377eb96cc5ba0dc04729ae61c047e9 | |
parent | d59c8ee79f91d41d0979bd09c5e50cc43916330c (diff) | |
download | tdebase-d4e06b76962198eb64e6c2826d4695248102037c.tar.gz tdebase-d4e06b76962198eb64e6c2826d4695248102037c.zip |
Replace listview's binary "Case Insensitive Sort" option with 3 mutually exclusive options:
1. Unicode based (AB...ab)
2. Unicode based, case insensitive (aAbB)
2. Locale based
This resolves issue #252.
Signed-off-by: Vincent Reher <tde@4reher.org>
-rw-r--r-- | konqueror/listview/konq_detailedlistview.rc | 10 | ||||
-rw-r--r-- | konqueror/listview/konq_infolistview.rc | 10 | ||||
-rw-r--r-- | konqueror/listview/konq_listview.cpp | 71 | ||||
-rw-r--r-- | konqueror/listview/konq_listview.h | 8 | ||||
-rw-r--r-- | konqueror/listview/konq_listviewitems.cpp | 10 | ||||
-rw-r--r-- | konqueror/listview/konq_listviewwidget.cpp | 12 | ||||
-rw-r--r-- | konqueror/listview/konq_listviewwidget.h | 3 | ||||
-rw-r--r-- | konqueror/listview/konq_textview.rc | 10 | ||||
-rw-r--r-- | konqueror/listview/konq_treeview.rc | 10 | ||||
-rw-r--r-- | libkonq/CMakeLists.txt | 1 | ||||
-rw-r--r-- | libkonq/Makefile.am | 3 | ||||
-rw-r--r-- | libkonq/konq_propsview.cpp | 27 | ||||
-rw-r--r-- | libkonq/konq_propsview.h | 5 | ||||
-rw-r--r-- | libkonq/konq_sort_constants.h | 13 | ||||
-rw-r--r-- | libkonq/konq_string_compare.h | 51 |
15 files changed, 204 insertions, 40 deletions
diff --git a/konqueror/listview/konq_detailedlistview.rc b/konqueror/listview/konq_detailedlistview.rc index 79059c6d4..06c9bc318 100644 --- a/konqueror/listview/konq_detailedlistview.rc +++ b/konqueror/listview/konq_detailedlistview.rc @@ -1,5 +1,5 @@ <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> -<kpartgui name="KonqDetailedListView" version="12"> +<kpartgui name="KonqDetailedListView" version="13"> <MenuBar> <Menu name="edit"><text>&Edit</text> <Menu name="selection"><text>Selection</text> @@ -24,12 +24,14 @@ </Menu> <Separator/> <Action name="show_dot"/> - <Menu name="sort"><text>Sort</text> + <Menu name="sort"><text>&Sort</text> + <Action name="order_unicode_based"/> + <Action name="order_unicode_based_case_insensitive"/> + <Action name="order_locale_based"/> + <Separator/> <Action name="group_directories_first"/> <Action name="group_hidden_first"/> <Separator/> - <Action name="sort_caseinsensitive"/> - <Separator/> <Action name="alternate_sort_order"/> <Action name="reverse_sort_order"/> </Menu> diff --git a/konqueror/listview/konq_infolistview.rc b/konqueror/listview/konq_infolistview.rc index 451eb5785..60f511b1f 100644 --- a/konqueror/listview/konq_infolistview.rc +++ b/konqueror/listview/konq_infolistview.rc @@ -1,5 +1,5 @@ <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> -<kpartgui name="KonqInfoListView" version="13"> +<kpartgui name="KonqInfoListView" version="14"> <MenuBar> <Menu name="edit"><text>&Edit</text> <Menu name="selection"><text>Selection</text> @@ -24,12 +24,14 @@ </Menu> <Separator/> <Action name="show_dot"/> - <Menu name="sort"><text>Sort</text> + <Menu name="sort"><text>&Sort</text> + <Action name="order_unicode_based"/> + <Action name="order_unicode_based_case_insensitive"/> + <Action name="order_locale_based"/> + <Separator/> <Action name="group_directories_first"/> <Action name="group_hidden_first"/> <Separator/> - <Action name="sort_caseinsensitive"/> - <Separator/> <Action name="alternate_sort_order"/> <Action name="reverse_sort_order"/> </Menu> diff --git a/konqueror/listview/konq_listview.cpp b/konqueror/listview/konq_listview.cpp index f8307e84c..5a06068ca 100644 --- a/konqueror/listview/konq_listview.cpp +++ b/konqueror/listview/konq_listview.cpp @@ -48,6 +48,8 @@ #include <unistd.h> #include <kinstance.h> +#include <konq_sort_constants.h> + KonqListViewFactory::KonqListViewFactory() { s_instance = 0; @@ -929,19 +931,50 @@ void KonqListView::setupActions() m_paShowDot = new TDEToggleAction( i18n( "Show &Hidden Files" ), 0, this, TQT_SLOT( slotShowDot() ), actionCollection(), "show_dot" ); // m_paShowDot->setCheckedState(i18n("Hide &Hidden Files")); + m_paCaseInsensitive = new TDEToggleAction(i18n("Case Insensitive Sort"), 0, this, TQT_SLOT(slotCaseInsensitive()),actionCollection(), "sort_caseinsensitive" ); m_paSortAlternate = new TDEAction( i18n( "&Alternate Sort Order" ), CTRL+Key_S, this, - TQT_SLOT( slotSortAlternate() ), actionCollection(), "alternate_sort_order"); + TQT_SLOT( slotSortAlternate() ), actionCollection(), "alternate_sort_order"); + m_paSortAlternate->setToolTip( i18n( "Sort by PREVIOUS sort column" ) ); m_paSortReverse = new TDEAction( i18n( "&Reverse Sort Order" ), CTRL+Key_R, this, TQT_SLOT( slotSortReverse() ), actionCollection(), "reverse_sort_order"); - - m_paDisplayDirectoriesFirst = new TDEToggleAction( i18n("Group &Directories First"), 0, this, + m_paSortReverse->setToolTip( i18n( "Reverse sort order of current sort column" ) ); + + /* + Build View->Sort submenu interface to properties + SortOrder, SortDirsFirst & SortHiddenFirst + */ + TextSortOrder initialOrder = m_pProps->getSortOrder(); + + m_paOrderUnicodeUnmodified = new TDEToggleAction( i18n( "&Unicode based" ), ALT+Key_1, this, + TQT_SLOT( slotOrderUnicodeUnmodified() ), actionCollection(), "order_unicode_based" ); + m_paOrderUnicodeUnmodified->setToolTip( i18n( "Strict numeric Unicode based order" ) ); + m_paOrderUnicodeUnmodified->setChecked( initialOrder == UNICODE_UNMODIFIED ); + + m_paOrderUnicodeCaseInsensitive = new TDEToggleAction( i18n( "Unicode based, &case insensitive" ), ALT+Key_2, this, + TQT_SLOT( slotOrderUnicodeCaseInsensitive() ), actionCollection(), "order_unicode_based_case_insensitive" ); + m_paOrderUnicodeCaseInsensitive->setToolTip( i18n( "Unicode based order but with lower/upper case ASCII letters adjacent" ) ); + m_paOrderUnicodeCaseInsensitive->setChecked(initialOrder == UNICODE_CASEINSENSITIVE); + + m_paOrderLocale = new TDEToggleAction( i18n( "&Locale based" ), ALT+Key_3, this, + TQT_SLOT( slotOrderLocale() ), actionCollection(), "order_locale_based" ); + m_paOrderLocale->setToolTip( i18n( "Locale based order, usually \"friendly\"" ) ); + m_paOrderLocale->setChecked(initialOrder == LOCALE_UNMODIFIED); + + // Convert above 3 checkbox menu items into single 3-way radio button menu item + m_paOrderUnicodeUnmodified->setExclusiveGroup( "sortOrder" ); + m_paOrderUnicodeCaseInsensitive->setExclusiveGroup( "sortOrder" ); + m_paOrderLocale->setExclusiveGroup( "sortOrder" ); + + m_paDisplayDirectoriesFirst = new TDEToggleAction( i18n("Group &Directories First"), CTRL+SHIFT+Key_F, this, TQT_SLOT(slotToggleDisplayDirectoriesFirst()), actionCollection(), "group_directories_first"); - m_paDisplayDirectoriesFirst->setChecked(m_pProps->isHiddenFirst()); + m_paDisplayDirectoriesFirst->setToolTip( i18n( "Always display directories before non-directories" ) ); + m_paDisplayDirectoriesFirst->setChecked(m_pProps->isDirsFirst()); - m_paDisplayHiddenFirst = new TDEToggleAction( i18n("Group &Hidden First"), 0, this, + m_paDisplayHiddenFirst = new TDEToggleAction( i18n("Group &Hidden First"), CTRL+SHIFT+Key_H, this, TQT_SLOT(slotToggleDisplayHiddenFirst()), actionCollection(), "group_hidden_first"); + m_paDisplayHiddenFirst->setToolTip( i18n( "Always display hidden files before non-hidden files" ) ); m_paDisplayHiddenFirst->setChecked(m_pProps->isHiddenFirst()); newIconSize( TDEIcon::SizeSmall /* default size */ ); @@ -955,6 +988,32 @@ void KonqListView::slotSelectionChanged() // m_paInvertSelection->setEnabled( itemSelected ); } -#include "konq_listview.moc" +void KonqListView::slotOrderUnicodeUnmodified() +{ + TextSortOrder sortOrder = UNICODE_UNMODIFIED ; + kdDebug(1202) << "Setting name order = " << sortOrder << endl; + m_pProps->setSortOrder( sortOrder ); + m_pListView->m_sortOrder = sortOrder; + m_pListView->sort(); +} +void KonqListView::slotOrderUnicodeCaseInsensitive() +{ + TextSortOrder sortOrder = UNICODE_CASEINSENSITIVE; + kdDebug(1202) << "Setting name order = " << sortOrder << endl; + m_pProps->setSortOrder( sortOrder ); + m_pListView->m_sortOrder = sortOrder; + m_pListView->sort(); +} + +void KonqListView::slotOrderLocale() +{ + TextSortOrder sortOrder = LOCALE_UNMODIFIED; + kdDebug(1202) << "Setting name order = " << sortOrder << endl; + m_pProps->setSortOrder( sortOrder ); + m_pListView->m_sortOrder = sortOrder; + m_pListView->sort(); +} + +#include "konq_listview.moc" diff --git a/konqueror/listview/konq_listview.h b/konqueror/listview/konq_listview.h index 666ae7743..fc72f6e87 100644 --- a/konqueror/listview/konq_listview.h +++ b/konqueror/listview/konq_listview.h @@ -130,8 +130,12 @@ protected slots: void slotSaveColumnWidths(); // delayed void slotHeaderClicked(int sec); + void slotOrderUnicodeUnmodified(); + void slotOrderUnicodeCaseInsensitive(); + void slotOrderLocale(); void slotToggleDisplayDirectoriesFirst(); void slotToggleDisplayHiddenFirst(); + void slotSortAlternate(); void slotSortReverse(); @@ -197,6 +201,10 @@ private: TDEToggleAction *m_paShowPermissions; TDEToggleAction *m_paShowURL; + TDEToggleAction *m_paOrderUnicodeUnmodified; + TDEToggleAction *m_paOrderUnicodeCaseInsensitive; + TDEToggleAction *m_paOrderLocale; + TDEToggleAction *m_paDisplayDirectoriesFirst; TDEToggleAction *m_paDisplayHiddenFirst; }; diff --git a/konqueror/listview/konq_listviewitems.cpp b/konqueror/listview/konq_listviewitems.cpp index cf4322ef0..1766a0b0b 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> @@ -303,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 ) diff --git a/konqueror/listview/konq_listviewwidget.cpp b/konqueror/listview/konq_listviewwidget.cpp index 4c89f529d..ef70fe949 100644 --- a/konqueror/listview/konq_listviewwidget.cpp +++ b/konqueror/listview/konq_listviewwidget.cpp @@ -100,6 +100,7 @@ KonqBaseListViewWidget::KonqBaseListViewWidget( KonqListView *parent, TQWidget * ,m_bAscending(true) ,m_itemFound(false) ,m_restored(false) + ,m_sortOrder(0) ,m_filenameColumn(0) ,m_itemToGoTo("") ,m_backgroundTimer(0) @@ -1211,11 +1212,7 @@ bool KonqBaseListViewWidget::openURL( const KURL &url ) { m_pBrowserView->newIconSize( m_pBrowserView->m_pProps->iconSize() ); m_pBrowserView->m_paShowDot->setChecked( m_pBrowserView->m_pProps->isShowingDotFiles() ); - if ( m_pBrowserView->m_paCaseInsensitive->isChecked() != m_pBrowserView->m_pProps->isCaseInsensitiveSort() ) { - m_pBrowserView->m_paCaseInsensitive->setChecked( m_pBrowserView->m_pProps->isCaseInsensitiveSort() ); - // This is in case openURL returned all items synchronously. - sort(); - } + m_sortOrder = m_pBrowserView->m_pProps->getSortOrder(); // It has to be "viewport()" - this is what KonqDirPart's slots act upon, // and otherwise we get a color/pixmap in the square between the scrollbars. @@ -1571,11 +1568,6 @@ void KonqBaseListViewWidget::slotUpdateBackground() } } -bool KonqBaseListViewWidget::caseInsensitiveSort() const -{ - return m_pBrowserView->m_pProps->isCaseInsensitiveSort(); -} - // based on isExecuteArea from tdelistview.cpp int KonqBaseListViewWidget::executeArea( TQListViewItem *_item ) { diff --git a/konqueror/listview/konq_listviewwidget.h b/konqueror/listview/konq_listviewwidget.h index 613f012b3..a8a06408b 100644 --- a/konqueror/listview/konq_listviewwidget.h +++ b/konqueror/listview/konq_listviewwidget.h @@ -137,7 +137,6 @@ public: void setAscending( bool b ) { m_bAscending = b; } bool ascending() const { return m_bAscending; } - bool caseInsensitiveSort() const; virtual void paintEmptyArea( TQPainter *p, const TQRect &r ); @@ -260,6 +259,8 @@ protected: bool m_itemFound:1; bool m_restored:1; + TextSortOrder m_sortOrder; + int m_filenameColumn; int m_filenameColumnWidth; diff --git a/konqueror/listview/konq_textview.rc b/konqueror/listview/konq_textview.rc index 20b20f451..e29a0293b 100644 --- a/konqueror/listview/konq_textview.rc +++ b/konqueror/listview/konq_textview.rc @@ -1,5 +1,5 @@ <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> -<kpartgui name="KonqTextView" version="6"> +<kpartgui name="KonqTextView" version="7"> <MenuBar> <Menu name="edit"><text>&Edit</text> <Menu name="selection"><text>Selection</text> @@ -13,12 +13,14 @@ </Menu> <Menu name="view"><text>&View</text> <Action name="show_dot" /> - <Menu name="sort"><text>Sort</text> + <Menu name="sort"><text>&Sort</text> + <Action name="order_unicode_based"/> + <Action name="order_unicode_based_case_insensitive"/> + <Action name="order_locale_based"/> + <Separator/> <Action name="group_directories_first"/> <Action name="group_hidden_first"/> <Separator/> - <Action name="sort_caseinsensitive"/> - <Separator/> <Action name="alternate_sort_order"/> <Action name="reverse_sort_order"/> </Menu> diff --git a/konqueror/listview/konq_treeview.rc b/konqueror/listview/konq_treeview.rc index 711f267be..9ef045785 100644 --- a/konqueror/listview/konq_treeview.rc +++ b/konqueror/listview/konq_treeview.rc @@ -1,5 +1,5 @@ <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> -<kpartgui name="KonqTreeView" version="11"> +<kpartgui name="KonqTreeView" version="12"> <MenuBar> <Menu name="edit"><text>&Edit</text> <Menu name="selection"><text>Selection</text> @@ -24,12 +24,14 @@ </Menu> <Separator/> <Action name="show_dot"/> - <Menu name="sort"><text>Sort</text> + <Menu name="sort"><text>&Sort</text> + <Action name="order_unicode_based"/> + <Action name="order_unicode_based_case_insensitive"/> + <Action name="order_locale_based"/> + <Separator/> <Action name="group_directories_first"/> <Action name="group_hidden_first"/> <Separator/> - <Action name="sort_caseinsensitive"/> - <Separator/> <Action name="alternate_sort_order"/> <Action name="reverse_sort_order"/> </Menu> diff --git a/libkonq/CMakeLists.txt b/libkonq/CMakeLists.txt index e774a81bb..c1780780d 100644 --- a/libkonq/CMakeLists.txt +++ b/libkonq/CMakeLists.txt @@ -43,6 +43,7 @@ install( FILES konq_historymgr.h konq_historycomm.h konq_pixmapprovider.h kivdirectoryoverlay.h kivfreespaceoverlay.h konq_faviconmgr.h konq_xmlguiclient.h konqbookmarkmanager.h konq_filetip.h + konq_sort_constants.h konq_string_compare.h DESTINATION ${INCLUDE_INSTALL_DIR} ) diff --git a/libkonq/Makefile.am b/libkonq/Makefile.am index 3290c3e85..3c3897155 100644 --- a/libkonq/Makefile.am +++ b/libkonq/Makefile.am @@ -52,7 +52,8 @@ include_HEADERS = konq_popupmenu.h knewmenu.h \ konq_pixmapprovider.h \ kivdirectoryoverlay.h \ kivfreespaceoverlay.h \ - konq_faviconmgr.h konq_xmlguiclient.h konqbookmarkmanager.h konq_filetip.h + konq_faviconmgr.h konq_xmlguiclient.h konqbookmarkmanager.h konq_filetip.h \ + konq_sort_constants.h konq_string_compare.h if include_ARTS diff --git a/libkonq/konq_propsview.cpp b/libkonq/konq_propsview.cpp index af7a65eae..f72aee191 100644 --- a/libkonq/konq_propsview.cpp +++ b/libkonq/konq_propsview.cpp @@ -34,6 +34,8 @@ #include <ksimpleconfig.h> +#include "konq_sort_constants.h" + static TQPixmap wallpaperPixmap( const TQString & _wallpaper ) { TQString key = "wallpapers/"; @@ -65,10 +67,11 @@ static TQPixmap wallpaperPixmap( const TQString & _wallpaper ) struct KonqPropsView::Private { TQStringList* previewsToShow; + TextSortOrder textSortOrder; bool previewsEnabled:1; bool caseInsensitiveSort:1; - bool hiddenfirst:1; bool dirsfirst:1; + bool hiddenfirst:1; bool descending:1; TQString sortcriterion; }; @@ -91,6 +94,7 @@ KonqPropsView::KonqPropsView( TDEInstance * instance, KonqPropsView * defaultPro m_iIconSize = config->readNumEntry( "IconSize", 0 ); m_iItemTextPos = config->readNumEntry( "ItemTextPos", TQIconView::Bottom ); d->sortcriterion = config->readEntry( "SortingCriterion", "sort_nci" ); + d->textSortOrder = (TextSortOrder) config->readNumEntry( "TextSortOrder", 1 ); d->dirsfirst = config->readBoolEntry( "SortDirsFirst", true ); d->hiddenfirst = config->readBoolEntry( "SortHiddenFirst", true ); d->descending = config->readBoolEntry( "SortDescending", false ); @@ -140,6 +144,11 @@ bool KonqPropsView::isCaseInsensitiveSort() const return d->caseInsensitiveSort; } +TextSortOrder KonqPropsView::getSortOrder() const +{ + return d->textSortOrder; +} + bool KonqPropsView::isDirsFirst() const { return d->dirsfirst; @@ -206,6 +215,7 @@ bool KonqPropsView::enterDir( const KURL & dir ) m_iIconSize = m_defaultProps->iconSize(); m_iItemTextPos = m_defaultProps->itemTextPos(); d->sortcriterion = m_defaultProps->sortCriterion(); + d->textSortOrder = m_defaultProps->getSortOrder(); d->dirsfirst = m_defaultProps->isDirsFirst(); d->hiddenfirst = m_defaultProps->isHiddenFirst(); d->descending = m_defaultProps->isDescending(); @@ -226,6 +236,7 @@ bool KonqPropsView::enterDir( const KURL & dir ) m_iIconSize = config->readNumEntry( "IconSize", m_iIconSize ); m_iItemTextPos = config->readNumEntry( "ItemTextPos", m_iItemTextPos ); d->sortcriterion = config->readEntry( "SortingCriterion" , d->sortcriterion ); + d->textSortOrder = (TextSortOrder) config->readNumEntry( "TextSortOrder", d->textSortOrder ); d->dirsfirst = config->readBoolEntry( "SortDirsFirst", d->dirsfirst ); d->hiddenfirst = config->readBoolEntry( "SortHiddenFirst", d->hiddenfirst ); d->descending = config->readBoolEntry( "SortDescending", d->descending ); @@ -324,6 +335,20 @@ void KonqPropsView::setSortCriterion( const TQString &criterion ) } } +void KonqPropsView::setSortOrder( TextSortOrder order) +{ + d->textSortOrder = order; + if ( m_defaultProps && !m_bSaveViewPropertiesLocally ) { + m_defaultProps->setSortOrder( order ); + } + else if (currentConfig()) + { + TDEConfigGroupSaver cgs(currentConfig(), currentGroup()); + currentConfig()->writeEntry( "TextSortOrder", d->textSortOrder ); + currentConfig()->sync(); + } +} + void KonqPropsView::setDirsFirst( bool first) { d->dirsfirst = first; diff --git a/libkonq/konq_propsview.h b/libkonq/konq_propsview.h index 84ffcf029..132c53a55 100644 --- a/libkonq/konq_propsview.h +++ b/libkonq/konq_propsview.h @@ -26,6 +26,8 @@ #include <kurl.h> #include <libkonq_export.h> +#include "konq_sort_constants.h" + class TDEInstance; class TDEConfigBase; class TDEConfig; @@ -90,6 +92,9 @@ public: void setSortCriterion( const TQString &criterion ); const TQString& sortCriterion() const; + void setSortOrder( TextSortOrder order); + TextSortOrder getSortOrder() const; + void setDirsFirst ( bool first ); bool isDirsFirst() const; diff --git a/libkonq/konq_sort_constants.h b/libkonq/konq_sort_constants.h new file mode 100644 index 000000000..f6c695b19 --- /dev/null +++ b/libkonq/konq_sort_constants.h @@ -0,0 +1,13 @@ +#ifndef KONQ_SORT_CONSTANTS_H +#define KONQ_SORT_CONSTANTS_H + +typedef unsigned short TextSortOrder; + // Can't use name 'SortOrder' because that's part of TQt + +enum { + UNICODE_UNMODIFIED = 0, + LOCALE_UNMODIFIED = 1, + UNICODE_CASEINSENSITIVE = 2, +} TextSortOrders; + +#endif // KONQ_SORT_CONSTANTS_H diff --git a/libkonq/konq_string_compare.h b/libkonq/konq_string_compare.h new file mode 100644 index 000000000..8d17d409f --- /dev/null +++ b/libkonq/konq_string_compare.h @@ -0,0 +1,51 @@ +#ifndef KONQ_STRING_COMPARE_H +#define KONQ_STRING_COMPARE_H + +#include "konq_sort_constants.h" + +static inline int stringCompare( + const TextSortOrder sortorder, + const TQString& a, + const TQString& b +) +{ + // Our caller probably determined sortorder from KonqPropsView::getSortOrder() + // but we have a reasonable fallback position for bogus values. + + switch(sortorder) { + + case UNICODE_UNMODIFIED: + /* + * Strictly character code(point) numeric comparison as defined + * by the Unicode Standard that is backward compatible with the + * the ASCII standard. + . */ + return a.compare( b ); + break; + + case UNICODE_CASEINSENSITIVE: + /* + * This is the traditional "case-insensitive" variation on character + * code order that ensures that ASCII lowercase and uppercase alphabetic + * characters are are grouped together instead of being separated by + * non-alphabetic ASCII characters [ \ ] ^ _ ` + */ + return a.lower().compare( b.lower() ); + break; + + case LOCALE_UNMODIFIED: + /* + * This is the pure locale-aware comparison as defined by ICU. + * Note: if LC_COLLATE == 'C' or 'Posix', this will produce same + * result as UNICODE_UNMODIFIED. + */ + return a.localeAwareCompare( b ); + break; + + default: // Treat as UNICODE_UNMODIFIED + return a.compare( b ); + break; + } +} + +#endif // KONQ_STRING_COMPARE_H |