Changeset View
Changeset View
Standalone View
Standalone View
tests/listjobtest.cpp
Show All 35 Lines | 29 | { | |||
---|---|---|---|---|---|
36 | quint64 entriesListed = 0; | 36 | quint64 entriesListed = 0; | ||
37 | 37 | | |||
38 | for (int i = 1; i < argc; ++i) { | 38 | for (int i = 1; i < argc; ++i) { | ||
39 | QUrl url = QUrl::fromUserInput(QString::fromLocal8Bit(argv[i]), QDir::currentPath()); | 39 | QUrl url = QUrl::fromUserInput(QString::fromLocal8Bit(argv[i]), QDir::currentPath()); | ||
40 | qDebug() << "Starting listJob for the URL:" << url; | 40 | qDebug() << "Starting listJob for the URL:" << url; | ||
41 | 41 | | |||
42 | KIO::ListJob *job = KIO::listDir(url, KIO::HideProgressInfo); | 42 | KIO::ListJob *job = KIO::listDir(url, KIO::HideProgressInfo); | ||
43 | job->setUiDelegate(nullptr); | 43 | job->setUiDelegate(nullptr); | ||
44 | job->addMetaData(QStringLiteral("details"), QStringLiteral("2")); // Default is 2 which means all details. 0 means just a few essential fields (KIO::UDSEntry::UDS_NAME, KIO::UDSEntry::UDS_FILE_TYPE and KIO::UDSEntry::UDS_LINK_DEST if it is a symbolic link. Not provided otherwise. | 44 | job->addMetaData(QStringLiteral("statDetails"), QString::number(KIO::StatDefault)); | ||
dfaure: It's a bit weird to use a StatJob enum in the ListJob class. But then again, it is about the… | |||||
It was @kossebau concern as well. I am open to suggestion to improve on that, maybe this enum should be in KIO namespace ? meven: > Does KIO::DefaultDetails make sense beyond stat in the KIO namespace? How does it match other… | |||||
Well if it's called KIO::StatDefaultDetails (with the extra "Stat" compared to the question above), then it doesn't need to be in KIO::StatJob. So yes, you could move the enum to the KIO namespace and define it in src/core/global.h dfaure: Well if it's called KIO::StatDefaultDetails (with the extra "Stat" compared to the question… | |||||
45 | 45 | | |||
46 | QObject::connect(job, &KIO::ListJob::entries, | 46 | QObject::connect(job, &KIO::ListJob::entries, | ||
47 | [&entriesListed] (KIO::Job*, const KIO::UDSEntryList &entries) { | 47 | [&entriesListed] (KIO::Job*, const KIO::UDSEntryList &entries) { | ||
48 | entriesListed += entries.size(); | 48 | entriesListed += entries.size(); | ||
49 | qDebug() << "Listed" << entriesListed << "files."; | 49 | qDebug() << "Listed" << entriesListed << "files."; | ||
50 | }); | 50 | }); | ||
51 | } | 51 | } | ||
52 | 52 | | |||
53 | return app.exec(); | 53 | return app.exec(); | ||
54 | } | 54 | } |
It's a bit weird to use a StatJob enum in the ListJob class. But then again, it is about the stat() done by listing.... So this is OK, I guess.