From aacfa4988921bed952fc600dccd7e6ceccb8780c Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sun, 8 May 2022 00:26:59 +0900 Subject: Improve user experience when requesting the list of available applications with 'appinfo:/' (makes Konqueror less irresponsive). Some code renaming for better clarity. Signed-off-by: Michele Calgaro --- src/appimpl.cpp | 74 +++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 29 deletions(-) (limited to 'src/appimpl.cpp') diff --git a/src/appimpl.cpp b/src/appimpl.cpp index f0efb32..cd3fe18 100644 --- a/src/appimpl.cpp +++ b/src/appimpl.cpp @@ -18,6 +18,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include "appinfo.h" #include "appimpl.h" #include @@ -33,39 +34,54 @@ #include -AppImpl::AppImpl() : TQObject() +AppImpl::AppImpl(TDEIO_AppInfo *slave) : TQObject(), m_slave(slave) { } -bool AppImpl::listRoot(TQValueList &list) +void AppImpl::listRoot() { - kdDebug() << "AppImpl::listRoot" << endl; - - //TQStringList dirList = TQStringList::split(":", getenv("PATH")); - TQStringList dirList; - dirList << "/opt/trinity/bin/"; - dirList << "/usr/bin/"; - dirList << "/usr/local/bin/"; - kdDebug() << dirList << endl; - - for (const TQString &dirName : dirList) - { - TQDir dir(dirName); - if (!dir.exists()) - { - continue; - } - - TQStringList filenames = dir.entryList(TQDir::Files | TQDir::Readable); - TDEIO::UDSEntry entry; - for (const TQString &filename : filenames) - { - createEntry(entry, filename); - list.append(entry); - } - } - - return true; + kdDebug() << "AppImpl::listRoot" << endl; + + // Top level entry + TDEIO::UDSEntry entry; + createTopLevelEntry(entry); + m_slave->listEntry(entry, false); + + //TQStringList dirList = TQStringList::split(":", getenv("PATH")); + TQStringList dirList; + dirList << "/opt/trinity/bin/"; + dirList << "/usr/bin/"; + dirList << "/usr/local/bin/"; + kdDebug() << dirList << endl; + + TQValueList list; + for (const TQString &dirName : dirList) + { + TQDir dir(dirName); + if (!dir.exists()) + { + continue; + } + + TQStringList filenames = dir.entryList(TQDir::Files | TQDir::Readable); + TDEIO::UDSEntry entry; + for (const TQString &filename : filenames) + { + createEntry(entry, filename); + list.append(entry); + if (list.count() >= 50) + { + m_slave->listEntries(list); + list.clear(); + } + } + } + if (list.count() > 0) + { + m_slave->listEntries(list); + list.clear(); + } + m_slave->finished(); } bool AppImpl::parseURL(const KURL &url, TQString &name, TQString &path) const -- cgit v1.2.1