D24941: [kpropertiesdialog] Display item text() when the file is readonly and otherwise would display "." or ""

Méven Car noreply at phabricator.kde.org
Fri Oct 25 16:51:29 BST 2019


meven added a comment.


  In D24941#553926 <https://phabricator.kde.org/D24941#553926>, @ngraham wrote:
  
  > 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.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D24941

To: meven, ngraham, #frameworks
Cc: kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20191025/96232d84/attachment.html>


More information about the Kde-frameworks-devel mailing list