D18915: Fix batchrename changing extension to lower case

Stefan BrĂ¼ns noreply at phabricator.kde.org
Wed Feb 20 22:55:40 GMT 2019


bruns added a comment.


  In D18915#416402 <https://phabricator.kde.org/D18915#416402>, @cfoster wrote:
  
  > In D18915#416400 <https://phabricator.kde.org/D18915#416400>, @bruns wrote:
  >
  > > https://doc.qt.io/qt-5/qmimedatabase.html#suffixForFileName
  > >
  > > > Returns the suffix for the file fileName, as known by the MIME database.
  > > >  This allows to pre-select "tar.bz2" for foo.tar.bz2, but still only "txt" for my.file.with.dots.txt.
  >
  >
  > This was the original method of getting the file extension however it was converting the file extensions to lower case.
  >
  > This can be demonstrated with the following code:
  >  QMimeDatabase db;
  >  QUrl url = (QString) "foo.TXT";
  >  const QString extension = db.suffixForFileName(url.toDisplayString());
  >  qDebug(qUtf8Printable(extension)); //outputs "txt"
  
  
  Just compare the extension after `.toLower()`, and if both match, keep the original one.

REPOSITORY
  R241 KIO

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

To: cfoster, #dolphin, #frameworks, abalaji
Cc: bruns, ngraham, elvisangelaccio, chinmoyr, kde-frameworks-devel, michaelh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20190220/bf1289c7/attachment.htm>


More information about the kfm-devel mailing list