From c2924536202aff0de054bab984c7305ee9eca1c9 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 4 Oct 2014 14:02:26 -0500 Subject: [PATCH] Sort non-root entries in KHelpCenter Make KHelpCenter entry sorting case-insensitive This resolves Bug 1849 --- khelpcenter/navigator.cpp | 5 ++++- khelpcenter/navigatorappitem.cpp | 5 +++++ khelpcenter/navigatorappitem.h | 1 + khelpcenter/navigatoritem.cpp | 5 +++++ khelpcenter/navigatoritem.h | 6 ++++-- 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/khelpcenter/navigator.cpp b/khelpcenter/navigator.cpp index 7d865d9a8..22f530a1f 100644 --- a/khelpcenter/navigator.cpp +++ b/khelpcenter/navigator.cpp @@ -230,6 +230,7 @@ void Navigator::insertParentAppDocs( const TQString &name, NavigatorItem *topIte } createItemFromDesktopFile( topItem, desktopFile ); } + topItem->sortChildItems( 0, true /* ascending */ ); } void Navigator::insertIOSlaveDocs( const TQString &name, NavigatorItem *topItem ) @@ -269,8 +270,10 @@ void Navigator::insertAppletDocs( NavigatorItem *topItem ) TQStringList files = appletDir.entryList( TQDir::Files | TQDir::Readable ); TQStringList::ConstIterator it = files.begin(); TQStringList::ConstIterator end = files.end(); - for ( ; it != end; ++it ) + for ( ; it != end; ++it ) { createItemFromDesktopFile( topItem, appletDir.absPath() + "/" + *it ); + } + topItem->sortChildItems( 0, true /* ascending */ ); } void Navigator::createItemFromDesktopFile( NavigatorItem *topItem, diff --git a/khelpcenter/navigatorappitem.cpp b/khelpcenter/navigatorappitem.cpp index 2c175386c..f759a76ee 100644 --- a/khelpcenter/navigatorappitem.cpp +++ b/khelpcenter/navigatorappitem.cpp @@ -156,6 +156,11 @@ bool NavigatorAppItem::populate( bool recursive ) return entriesAdded; } +TQString NavigatorAppItem::key( int column, bool ascending ) const +{ + return text( column ).lower(); +} + TQString NavigatorAppItem::documentationURL( KService *s ) { TQString docPath = s->property( "DocPath" ).toString(); diff --git a/khelpcenter/navigatorappitem.h b/khelpcenter/navigatorappitem.h index ddebe964a..c89e1de77 100644 --- a/khelpcenter/navigatorappitem.h +++ b/khelpcenter/navigatorappitem.h @@ -43,6 +43,7 @@ class NavigatorAppItem : public NavigatorItem virtual void setOpen(bool); bool populate( bool recursive = false ); + virtual TQString key( int column, bool ascending ) const; protected: TQString documentationURL( KService *s ); diff --git a/khelpcenter/navigatoritem.cpp b/khelpcenter/navigatoritem.cpp index e20d979b6..ad464bacb 100644 --- a/khelpcenter/navigatoritem.cpp +++ b/khelpcenter/navigatoritem.cpp @@ -102,4 +102,9 @@ void NavigatorItem::setOpen( bool open ) } } +TQString NavigatorItem::key( int column, bool ascending ) const +{ + return text( column ).lower(); +} + // vim:ts=2:sw=2:et diff --git a/khelpcenter/navigatoritem.h b/khelpcenter/navigatoritem.h index e460f8208..7808b9cda 100644 --- a/khelpcenter/navigatoritem.h +++ b/khelpcenter/navigatoritem.h @@ -49,12 +49,14 @@ class NavigatorItem : public TQListViewItem TOC *toc() const { return mToc; } TOC *createTOC(); - + void setOpen( bool open ); + virtual TQString key( int column, bool ascending ) const; + private: void init( DocEntry * ); - + TOC *mToc; DocEntry *mEntry;