Changeset View
Changeset View
Standalone View
Standalone View
src/kquery.cpp
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | 40 | KQuery::KQuery(QObject *parent) | |||
---|---|---|---|---|---|
51 | , m_regexpForContent(false) | 51 | , m_regexpForContent(false) | ||
52 | , m_useLocate(false) | 52 | , m_useLocate(false) | ||
53 | , m_showHiddenFiles(false) | 53 | , m_showHiddenFiles(false) | ||
54 | , job(nullptr) | 54 | , job(nullptr) | ||
55 | , m_insideCheckEntries(false) | 55 | , m_insideCheckEntries(false) | ||
56 | , m_result(0) | 56 | , m_result(0) | ||
57 | { | 57 | { | ||
58 | processLocate = new KProcess(this); | 58 | processLocate = new KProcess(this); | ||
59 | connect(processLocate, SIGNAL(readyReadStandardOutput()), this, SLOT(slotreadyReadStandardOutput())); | 59 | connect(processLocate, &KProcess::readyReadStandardOutput, this, &KQuery::slotreadyReadStandardOutput); | ||
60 | connect(processLocate, SIGNAL(readyReadStandardError()), this, SLOT(slotreadyReadStandardError())); | 60 | connect(processLocate, &KProcess::readyReadStandardError, this, &KQuery::slotreadyReadStandardError); | ||
61 | connect(processLocate, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotendProcessLocate(int,QProcess::ExitStatus))); | 61 | connect(processLocate, QOverload<int, QProcess::ExitStatus>::of(&KProcess::finished), this, &KQuery::slotendProcessLocate); | ||
62 | 62 | | |||
63 | // Files with these mime types can be ignored, even if | 63 | // Files with these mime types can be ignored, even if | ||
64 | // findFormatByFileContent() in some cases may claim that | 64 | // findFormatByFileContent() in some cases may claim that | ||
65 | // these are text files: | 65 | // these are text files: | ||
66 | ignore_mimetypes.append(QStringLiteral("application/pdf")); | 66 | ignore_mimetypes.append(QStringLiteral("application/pdf")); | ||
67 | ignore_mimetypes.append(QStringLiteral("application/postscript")); | 67 | ignore_mimetypes.append(QStringLiteral("application/postscript")); | ||
68 | 68 | | |||
69 | // PLEASE update the documentation when you add another | 69 | // PLEASE update the documentation when you add another | ||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | 129 | } else { //Use KIO | |||
130 | if (m_recursive) { | 130 | if (m_recursive) { | ||
131 | job = KIO::listRecursive(m_url, KIO::HideProgressInfo); | 131 | job = KIO::listRecursive(m_url, KIO::HideProgressInfo); | ||
132 | } else { | 132 | } else { | ||
133 | job = KIO::listDir(m_url, KIO::HideProgressInfo); | 133 | job = KIO::listDir(m_url, KIO::HideProgressInfo); | ||
134 | } | 134 | } | ||
135 | 135 | | |||
136 | connect(job, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)), | 136 | connect(job, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)), | ||
137 | SLOT(slotListEntries(KIO::Job*,KIO::UDSEntryList))); | 137 | SLOT(slotListEntries(KIO::Job*,KIO::UDSEntryList))); | ||
138 | connect(job, SIGNAL(result(KJob*)), SLOT(slotResult(KJob*))); | 138 | connect(job, &KIO::ListJob::result, this, &KQuery::slotResult); | ||
139 | connect(job, SIGNAL(canceled(KJob*)), SLOT(slotCanceled(KJob*))); | | |||
140 | } | 139 | } | ||
141 | } | 140 | } | ||
142 | 141 | | |||
143 | void KQuery::slotResult(KJob *_job) | 142 | void KQuery::slotResult(KJob *_job) | ||
144 | { | 143 | { | ||
145 | if (job != _job) { | 144 | if (job != _job) { | ||
146 | return; | 145 | return; | ||
147 | } | 146 | } | ||
148 | job = nullptr; | 147 | job = nullptr; | ||
149 | 148 | | |||
150 | m_result = _job->error(); | 149 | m_result = _job->error(); | ||
151 | checkEntries(); | 150 | if (m_result == KIO::ERR_USER_CANCELED) { | ||
152 | } | | |||
153 | | ||||
154 | void KQuery::slotCanceled(KJob *_job) | | |||
155 | { | | |||
156 | if (job != _job) { | | |||
157 | return; | | |||
158 | } | | |||
159 | job = nullptr; | | |||
160 | | ||||
161 | m_fileItems.clear(); | 151 | m_fileItems.clear(); | ||
162 | 152 | } | |||
163 | m_result = KIO::ERR_USER_CANCELED; | | |||
164 | checkEntries(); | 153 | checkEntries(); | ||
165 | } | 154 | } | ||
166 | 155 | | |||
167 | void KQuery::slotListEntries(KIO::Job *, const KIO::UDSEntryList &list) | 156 | void KQuery::slotListEntries(KIO::Job *, const KIO::UDSEntryList &list) | ||
168 | { | 157 | { | ||
169 | const KIO::UDSEntryList::ConstIterator end = list.constEnd(); | 158 | const KIO::UDSEntryList::ConstIterator end = list.constEnd(); | ||
170 | 159 | | |||
171 | for (KIO::UDSEntryList::ConstIterator it = list.constBegin(); it != end; ++it) { | 160 | for (KIO::UDSEntryList::ConstIterator it = list.constBegin(); it != end; ++it) { | ||
▲ Show 20 Lines • Show All 459 Lines • Show Last 20 Lines |