summaryrefslogtreecommitdiffstats
path: root/src/appimpl.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2022-05-08 00:26:59 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2022-05-08 00:26:59 +0900
commitaacfa4988921bed952fc600dccd7e6ceccb8780c (patch)
tree19e8ec7f87031e128cbfa10ba29954366c6c8c81 /src/appimpl.cpp
parent8e55bfc59469faf50b41d90ac716b89f5fc1c684 (diff)
downloadtdeio-appinfo-aacfa4988921bed952fc600dccd7e6ceccb8780c.tar.gz
tdeio-appinfo-aacfa4988921bed952fc600dccd7e6ceccb8780c.zip
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 <michele.calgaro@yahoo.it>
Diffstat (limited to 'src/appimpl.cpp')
-rw-r--r--src/appimpl.cpp74
1 files changed, 45 insertions, 29 deletions
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 <stdlib.h>
@@ -33,39 +34,54 @@
#include <tdeio/job.h>
-AppImpl::AppImpl() : TQObject()
+AppImpl::AppImpl(TDEIO_AppInfo *slave) : TQObject(), m_slave(slave)
{
}
-bool AppImpl::listRoot(TQValueList<TDEIO::UDSEntry> &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<TDEIO::UDSEntry> 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