Changeset View
Changeset View
Standalone View
Standalone View
src/filewidgets/knewfilemenu.cpp
Show First 20 Lines • Show All 1310 Lines • ▼ Show 20 Line(s) | |||||
1311 | } | 1311 | } | ||
1312 | 1312 | | |||
1313 | void KNewFileMenu::slotResult(KJob *job) | 1313 | void KNewFileMenu::slotResult(KJob *job) | ||
1314 | { | 1314 | { | ||
1315 | if (job->error()) { | 1315 | if (job->error()) { | ||
1316 | static_cast<KIO::Job *>(job)->uiDelegate()->showErrorMessage(); | 1316 | static_cast<KIO::Job *>(job)->uiDelegate()->showErrorMessage(); | ||
1317 | } else { | 1317 | } else { | ||
1318 | // Was this a copy or a mkdir? | 1318 | // Was this a copy or a mkdir? | ||
1319 | if (job->property("newDirectoryURL").isValid()) { | ||||
1320 | QUrl newDirectoryURL = job->property("newDirectoryURL").toUrl(); | ||||
1321 | emit directoryCreated(newDirectoryURL); | ||||
1322 | } else { | ||||
1319 | KIO::CopyJob *copyJob = ::qobject_cast<KIO::CopyJob *>(job); | 1323 | KIO::CopyJob *copyJob = ::qobject_cast<KIO::CopyJob *>(job); | ||
1320 | if (copyJob) { | 1324 | if (copyJob) { | ||
1321 | const QUrl destUrl = copyJob->destUrl(); | 1325 | const QUrl destUrl = copyJob->destUrl(); | ||
1322 | const QUrl localUrl = d->mostLocalUrl(destUrl); | 1326 | const QUrl localUrl = d->mostLocalUrl(destUrl); | ||
1323 | if (localUrl.isLocalFile()) { | 1327 | if (localUrl.isLocalFile()) { | ||
1324 | // Normal (local) file. Need to "touch" it, kio_file copied the mtime. | 1328 | // Normal (local) file. Need to "touch" it, kio_file copied the mtime. | ||
1325 | (void) ::utime(QFile::encodeName(localUrl.toLocalFile()).constData(), nullptr); | 1329 | (void) ::utime(QFile::encodeName(localUrl.toLocalFile()).constData(), nullptr); | ||
1326 | } | 1330 | } | ||
1327 | emit fileCreated(destUrl); | 1331 | emit fileCreated(destUrl); | ||
1328 | } else if (KIO::SimpleJob *simpleJob = ::qobject_cast<KIO::SimpleJob *>(job)) { | 1332 | } else if (KIO::SimpleJob *simpleJob = ::qobject_cast<KIO::SimpleJob *>(job)) { | ||
1329 | // Called in the storedPut() case | 1333 | // Called in the storedPut() case | ||
1330 | org::kde::KDirNotify::emitFilesAdded(simpleJob->url().adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash)); | 1334 | org::kde::KDirNotify::emitFilesAdded(simpleJob->url().adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash)); | ||
1331 | emit fileCreated(simpleJob->url()); | 1335 | emit fileCreated(simpleJob->url()); | ||
1332 | } | 1336 | } | ||
1333 | | ||||
1334 | if (job->property("newDirectoryURL").isValid()) { | | |||
1335 | QUrl newDirectoryURL = job->property("newDirectoryURL").toUrl(); | | |||
1336 | emit directoryCreated(newDirectoryURL); | | |||
1337 | } | 1337 | } | ||
1338 | } | 1338 | } | ||
1339 | if (!d->m_tempFileToDelete.isEmpty()) { | 1339 | if (!d->m_tempFileToDelete.isEmpty()) { | ||
1340 | QFile::remove(d->m_tempFileToDelete); | 1340 | QFile::remove(d->m_tempFileToDelete); | ||
1341 | } | 1341 | } | ||
1342 | } | 1342 | } | ||
1343 | 1343 | | |||
1344 | QStringList KNewFileMenu::supportedMimeTypes() const | 1344 | QStringList KNewFileMenu::supportedMimeTypes() const | ||
1345 | { | 1345 | { | ||
1346 | return d->m_supportedMimeTypes; | 1346 | return d->m_supportedMimeTypes; | ||
1347 | } | 1347 | } | ||
1348 | 1348 | | |||
1349 | #include "moc_knewfilemenu.cpp" | 1349 | #include "moc_knewfilemenu.cpp" | ||
1350 | 1350 | |