diff options
| author | Nate Graham <[email protected]> | 2020-04-05 16:49:57 -0600 |
|---|---|---|
| committer | Nate Graham <[email protected]> | 2020-04-05 16:49:57 -0600 |
| commit | de9a05966e951257b1f49b7020df8e45052a991a (patch) | |
| tree | bcc7e73ff5a39d494c5e05a7b3b03777dda1ea1f /src | |
| parent | 40035fe5bf4d146ba1d480493ddb1da2779180af (diff) | |
| parent | 9b82b08fb18724662c69ed288b1a36a215548539 (diff) | |
Merge branch 'release/20.04'
Diffstat (limited to 'src')
| -rw-r--r-- | src/views/dolphinview.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 2f9f2a386..d8f2aab93 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -719,24 +719,25 @@ void DolphinView::duplicateSelectedItems() QList<QUrl> newSelection; for (const auto &item : itemList) { const QUrl originalURL = item.url(); + const QString originalDirectoryPath = originalURL.adjusted(QUrl::RemoveFilename).path(); const QString originalFileName = item.name(); + QString extension = db.suffixForFileName(originalFileName); QUrl duplicateURL = originalURL; // No extension; new filename is "<oldfilename> copy" if (extension.isEmpty()) { - duplicateURL.setPath(i18nc("<file path> copy", "%1 copy", originalURL.path())); + duplicateURL.setPath(originalDirectoryPath + i18nc("<filename> copy", "%1 copy", originalFileName)); // There's an extension; new filename is "<oldfilename> copy.<extension>" } else { // Need to add a dot since QMimeDatabase::suffixForFileName() doesn't include it extension = QLatin1String(".") + extension; - const QString directoryPath = originalURL.adjusted(QUrl::RemoveFilename).path(); const QString originalFilenameWithoutExtension = originalFileName.chopped(extension.size()); // Preserve file's original filename extension in case the casing differs // from what QMimeDatabase::suffixForFileName() returned const QString originalExtension = originalFileName.right(extension.size()); - duplicateURL.setPath(i18nc("<file path><filename> copy.<extension>", "%1%2 copy%3", directoryPath, originalFilenameWithoutExtension, originalExtension)); + duplicateURL.setPath(originalDirectoryPath + i18nc("<filename> copy", "%1 copy", originalFilenameWithoutExtension) + originalExtension); } KIO::CopyJob* job = KIO::copyAs(originalURL, duplicateURL, KIO::HideProgressInfo); |
