Skip to content

[kio][185433] Allowing double-quotes in open/save dialog

Andreas Bontozoglou requested to merge (removed):fix_kio_185433 into master

BUG: 185433

tl;dr: Allowing double-quotes in filenames in KFileWidget by escaping them with \ and modifying the tokenizer to understand this.

In this patch:

  • Introduce escapeDoubleQuotes function that is used to escape selected file paths and correctly populate the locationEdit

  • Disabling old KFileWidgetPrivate::tokenize and writing a new one which works by iterating each character in the locationEdit while it remembers if it is in "escape mode" (seen a '') or not.

  • Introducing public API KFileWidget::setSelectedUrls. This was mainly needed for the tests to work. I originally wanted to test only the tokenizer but (a) this is in private implementation and (b) testing that things are escaped properly in the text-box is also very important

  • Adding a test for various filenames that contain a mix of backslashes and quotes

  • Adding a new logging category for the kfilewidget.cpp (KIO_KFILEWIDGETS_FW)

  • Adding command-line options to kfilewidgettest_saving_gui which I used for functional tests at some point. My work there is a bit sloppy atm but I assume this is an auxiliary file (let me now if you want me to clean it up)

Questions:

  • Do I need to add a @since in the docblock?

  • Do I need to change minor/major version here (and how would I do this)? I am not sure if the addition of setSelectedUrls is backwards compatible

Merge request reports