Changeset View
Changeset View
Standalone View
Standalone View
src/ioslaves/trash/trashimpl.cpp
Show All 28 Lines | |||||
29 | #include <kio/deletejob.h> | 29 | #include <kio/deletejob.h> | ||
30 | #include <qdebug.h> | 30 | #include <qdebug.h> | ||
31 | #include <QUrl> | 31 | #include <QUrl> | ||
32 | #include <kdirnotify.h> | 32 | #include <kdirnotify.h> | ||
33 | #include <KSharedConfig> | 33 | #include <KSharedConfig> | ||
34 | #include <kfileitem.h> | 34 | #include <kfileitem.h> | ||
35 | #include <kconfiggroup.h> | 35 | #include <kconfiggroup.h> | ||
36 | #include <kmountpoint.h> | 36 | #include <kmountpoint.h> | ||
37 | #include <kfileutils.h> | ||||
37 | 38 | | |||
38 | #include <QCoreApplication> | 39 | #include <QCoreApplication> | ||
39 | #include <QEventLoop> | 40 | #include <QEventLoop> | ||
40 | #include <QFile> | 41 | #include <QFile> | ||
41 | #include <QDir> | 42 | #include <QDir> | ||
42 | #include <kjobuidelegate.h> | 43 | #include <kjobuidelegate.h> | ||
43 | 44 | | |||
44 | #include <sys/stat.h> | 45 | #include <sys/stat.h> | ||
▲ Show 20 Lines • Show All 251 Lines • ▼ Show 20 Line(s) | 292 | #endif | |||
296 | QString fileName; | 297 | QString fileName; | ||
297 | do { | 298 | do { | ||
298 | //qCDebug(KIO_TRASH) << "trying to create" << url.path(); | 299 | //qCDebug(KIO_TRASH) << "trying to create" << url.path(); | ||
299 | fd = ::open(QFile::encodeName(url.path()).constData(), O_WRONLY | O_CREAT | O_EXCL, 0600); | 300 | fd = ::open(QFile::encodeName(url.path()).constData(), O_WRONLY | O_CREAT | O_EXCL, 0600); | ||
300 | if (fd < 0) { | 301 | if (fd < 0) { | ||
301 | if (errno == EEXIST) { | 302 | if (errno == EEXIST) { | ||
302 | fileName = url.fileName(); | 303 | fileName = url.fileName(); | ||
303 | url = url.adjusted(QUrl::RemoveFilename); | 304 | url = url.adjusted(QUrl::RemoveFilename); | ||
304 | url.setPath(url.path() + KIO::suggestName(baseDirectory, fileName)); | 305 | url.setPath(url.path() + KFileUtils::suggestName(baseDirectory, fileName)); | ||
305 | // and try again on the next iteration | 306 | // and try again on the next iteration | ||
306 | } else { | 307 | } else { | ||
307 | error(KIO::ERR_COULD_NOT_WRITE, url.path()); | 308 | error(KIO::ERR_COULD_NOT_WRITE, url.path()); | ||
308 | return false; | 309 | return false; | ||
309 | } | 310 | } | ||
310 | } | 311 | } | ||
311 | } while (fd < 0); | 312 | } while (fd < 0); | ||
312 | const QString infoPath = url.path(); | 313 | const QString infoPath = url.path(); | ||
▲ Show 20 Lines • Show All 1106 Lines • Show Last 20 Lines |