From ee90275a69840647dccfcde9cec96121d38db13d Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 17 Mar 2014 13:56:06 +0900 Subject: The output of "tdecmshell --list" is now sorted by ascending module name. This resolves bug 1893. --- tdecmshell/main.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'tdecmshell') diff --git a/tdecmshell/main.cpp b/tdecmshell/main.cpp index 43ec7a9e9..9ca169c2f 100644 --- a/tdecmshell/main.cpp +++ b/tdecmshell/main.cpp @@ -231,22 +231,25 @@ extern "C" KDE_EXPORT int kdemain(int _argc, char *_argv[]) int maxLen=0; - for( KService::List::ConstIterator it = m_modules.begin(); it != m_modules.end(); ++it) + for (KService::List::ConstIterator it = m_modules.begin(); it != m_modules.end(); ++it) { int len = (*it)->desktopEntryName().length(); if (len > maxLen) maxLen = len; } - for( KService::List::ConstIterator it = m_modules.begin(); it != m_modules.end(); ++it) + TQStringList module_list; + for (KService::List::ConstIterator it = m_modules.begin(); it != m_modules.end(); ++it) { - TQString entry("%1 - %2"); - - entry = entry.arg((*it)->desktopEntryName().leftJustify(maxLen, ' ')) - .arg(!(*it)->comment().isEmpty() ? (*it)->comment() - : i18n("No description available")); + module_list.append(TQString("%1 - %2") + .arg((*it)->desktopEntryName().leftJustify(maxLen, ' ')) + .arg(!(*it)->comment().isEmpty() ? (*it)->comment() : i18n("No description available"))); + } + module_list.sort(); - cout << static_cast(entry.local8Bit()) << endl; + for (TQStringList::Iterator it=module_list.begin(); it!=module_list.end(); ++it) + { + cout << static_cast((*it).local8Bit()) << endl; } return 0; } -- cgit v1.2.1