Changeset View
Changeset View
Standalone View
Standalone View
krusader/FileSystem/defaultfilesystem.cpp
Show All 39 Lines | |||||
40 | #include <kio_version.h> | 40 | #include <kio_version.h> | ||
41 | 41 | | |||
42 | #include "fileitem.h" | 42 | #include "fileitem.h" | ||
43 | #include "../defaults.h" | 43 | #include "../defaults.h" | ||
44 | #include "../krglobal.h" | 44 | #include "../krglobal.h" | ||
45 | #include "../krservices.h" | 45 | #include "../krservices.h" | ||
46 | #include "../JobMan/krjob.h" | 46 | #include "../JobMan/krjob.h" | ||
47 | 47 | | |||
48 | DefaultFileSystem::DefaultFileSystem(): FileSystem(), _watcher() | 48 | DefaultFileSystem::DefaultFileSystem() | ||
49 | { | 49 | { | ||
50 | _type = FS_DEFAULT; | 50 | _type = FS_DEFAULT; | ||
51 | } | 51 | } | ||
52 | 52 | | |||
53 | void DefaultFileSystem::copyFiles(const QList<QUrl> &urls, const QUrl &destination, | 53 | void DefaultFileSystem::copyFiles(const QList<QUrl> &urls, const QUrl &destination, | ||
54 | KIO::CopyJob::CopyMode mode, bool showProgressInfo, | 54 | KIO::CopyJob::CopyMode mode, bool showProgressInfo, | ||
55 | JobMan::StartMode startMode) | 55 | JobMan::StartMode startMode) | ||
56 | { | 56 | { | ||
▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Line(s) | 190 | { | |||
208 | KIO::ListJob *job = KIO::listDir(_currentDirectory, KIO::HideProgressInfo, showHiddenFiles()); | 208 | KIO::ListJob *job = KIO::listDir(_currentDirectory, KIO::HideProgressInfo, showHiddenFiles()); | ||
209 | connect(job, &KIO::ListJob::entries, this, &DefaultFileSystem::slotAddFiles); | 209 | connect(job, &KIO::ListJob::entries, this, &DefaultFileSystem::slotAddFiles); | ||
210 | connect(job, &KIO::ListJob::redirection, this, &DefaultFileSystem::slotRedirection); | 210 | connect(job, &KIO::ListJob::redirection, this, &DefaultFileSystem::slotRedirection); | ||
211 | connect(job, &KIO::ListJob::permanentRedirection, this, &DefaultFileSystem::slotRedirection); | 211 | connect(job, &KIO::ListJob::permanentRedirection, this, &DefaultFileSystem::slotRedirection); | ||
212 | connect(job, &KIO::Job::result, this, &DefaultFileSystem::slotListResult); | 212 | connect(job, &KIO::Job::result, this, &DefaultFileSystem::slotListResult); | ||
213 | 213 | | |||
214 | // ensure connection credentials are asked only once | 214 | // ensure connection credentials are asked only once | ||
215 | if(!parentWindow.isNull()) { | 215 | if(!parentWindow.isNull()) { | ||
216 | KIO::JobUiDelegate *ui = static_cast<KIO::JobUiDelegate*>(job->uiDelegate()); | 216 | auto *ui = dynamic_cast<KIO::JobUiDelegate*>(job->uiDelegate()); | ||
217 | ui->setWindow(parentWindow); | 217 | ui->setWindow(parentWindow); | ||
218 | } | 218 | } | ||
219 | 219 | | |||
220 | emit refreshJobStarted(job); | 220 | emit refreshJobStarted(job); | ||
221 | 221 | | |||
222 | _listError = false; | 222 | _listError = false; | ||
223 | // ugly: we have to wait here until the list job is finished | 223 | // ugly: we have to wait here until the list job is finished | ||
224 | QEventLoop eventLoop; | 224 | QEventLoop eventLoop; | ||
Show All 13 Lines | 236 | if (job && job->error()) { | |||
238 | _listError = true; | 238 | _listError = true; | ||
239 | qDebug() << "error=" << job->errorString() << "; text=" << job->errorText(); | 239 | qDebug() << "error=" << job->errorString() << "; text=" << job->errorText(); | ||
240 | emit error(job->errorString()); // display error message (in panel) | 240 | emit error(job->errorString()); // display error message (in panel) | ||
241 | } | 241 | } | ||
242 | } | 242 | } | ||
243 | 243 | | |||
244 | void DefaultFileSystem::slotAddFiles(KIO::Job *, const KIO::UDSEntryList& entries) | 244 | void DefaultFileSystem::slotAddFiles(KIO::Job *, const KIO::UDSEntryList& entries) | ||
245 | { | 245 | { | ||
246 | for (const KIO::UDSEntry entry : entries) { | 246 | for (const KIO::UDSEntry& entry : entries) { | ||
247 | FileItem *fileItem = FileSystem::createFileItemFromKIO(entry, _currentDirectory); | 247 | FileItem *fileItem = FileSystem::createFileItemFromKIO(entry, _currentDirectory); | ||
248 | if (fileItem) { | 248 | if (fileItem) { | ||
249 | addFileItem(fileItem); | 249 | addFileItem(fileItem); | ||
250 | } | 250 | } | ||
251 | } | 251 | } | ||
252 | } | 252 | } | ||
253 | 253 | | |||
254 | void DefaultFileSystem::slotRedirection(KIO::Job *job, const QUrl &url) | 254 | void DefaultFileSystem::slotRedirection(KIO::Job *job, const QUrl &url) | ||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 356 | if (!QDir::setCurrent(path)) { | |||
357 | emit error(i18nc("%1=folder path", "Access to %1 denied", path)); | 357 | emit error(i18nc("%1=folder path", "Access to %1 denied", path)); | ||
358 | QT_CLOSEDIR(dir); | 358 | QT_CLOSEDIR(dir); | ||
359 | return false; | 359 | return false; | ||
360 | } | 360 | } | ||
361 | 361 | | |||
362 | QT_DIRENT* dirEnt; | 362 | QT_DIRENT* dirEnt; | ||
363 | QString name; | 363 | QString name; | ||
364 | const bool showHidden = showHiddenFiles(); | 364 | const bool showHidden = showHiddenFiles(); | ||
365 | while ((dirEnt = QT_READDIR(dir)) != NULL) { | 365 | while ((dirEnt = QT_READDIR(dir)) != nullptr) { | ||
366 | name = QString::fromLocal8Bit(dirEnt->d_name); | 366 | name = QString::fromLocal8Bit(dirEnt->d_name); | ||
367 | 367 | | |||
368 | // show hidden files? | 368 | // show hidden files? | ||
369 | if (!showHidden && name.left(1) == ".") continue; | 369 | if (!showHidden && name.left(1) == ".") continue; | ||
370 | // we don't need the "." and ".." entries | 370 | // we don't need the "." and ".." entries | ||
371 | if (name == "." || name == "..") continue; | 371 | if (name == "." || name == "..") continue; | ||
372 | 372 | | |||
373 | FileItem* temp = createLocalFileItem(name); | 373 | FileItem* temp = createLocalFileItem(name); | ||
Show All 39 Lines |