Before:
After:
No Linters Available |
No Unit Test Coverage |
Buildable 18157 | |
Build 18175: arc lint + arc unit |
Do we know why d->oldname is empty or . in the first place? Feels like maybe this should be fixed there.
line 873 in kpropertiesdialog.cpp
// Extract the file name only filename = properties->defaultName(); if (filename.isEmpty()) { // no template const QFileInfo finfo(item.name()); // this gives support for UDS_NAME, e.g. for kio_trash or kio_system filename = finfo.fileName(); // Make sure only the file's name is displayed (#160964). } else { d->m_bFromTemplate = true; setDirty(); // to enforce that the copy happens } d->oldFileName = filename; // Make it human-readable filename = nameFromFileName(filename); if (d->bKDesktopMode && d->bDesktopFile) { KDesktopFile config(url.toLocalFile()); if (config.desktopGroup().hasKey("Name")) { filename = config.readName(); } } d->oldName = filename;
oldName can be from the defaultName passed to the constructor of KPropertiesDialog, QFileInfo.fileName() i.e UDS_NAME ("." by neccessity in case of root of ioslaves) or the Name field of the item desktop file.
I guess you are right this would need some fixing here, the code is convoluted IMO.
You're right that the code is quite convoluted. But it would seem to make sense to fix the value there rather than conditionally overriding it later.