I added a test apps + autotest
Details
Diff Detail
- Repository
- R241 KIO
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Most of this is just forwarding code from KFileWidget, so we could just use that directly? I mean if our LO integration is going to be the only user of this class, then maybe we should start by adding this code there and only upstream it if we think more people are going to use it?
It's the problem that if class doesn't exist nobody will think to use it (or he will reimplement it).
After that it's not a problem for me to put this code only in LO :)
As you want :)
Hmm. I can see the usefulness, it's certainly much better than the way people have historically inserted custom widgets into QFileDialog (https://stackoverflow.com/questions/16987916/add-widgets-to-qfiledialog, URGH).
On the other hand, I'm wondering if this is going to be abused as a KFileDialog replacement, losing the "native" look-n-feel for the file dialog on Windows / macOS.
Well, that's certainly a pre-requisite for any custom widget to work, it should just be made extra clear to app developers that what they lose in return is the ability to get native dialogs on Windows and macOS (and Gnome, I suppose).
So, I'm OK with this, provided that this documentation is added:
The downside of using this class is that your application will not be able to get a native file dialog on non-Plasma environments (Windows, macOS, ...). For this reason you should really think twice before deciding to use it, as a custom widget might improve user experience within the Plasma workspace, but might make it worse for users who are used to the native file dialog. In 99% of the cases, you want to use QFileDialog instead.
autotests/kfilecustomdialogtest.cpp | ||
---|---|---|
43 | This isn't really testing anything useful. Rename the layout and the test breaks. Maybe better verify that dlg itself has a layout, rather than "there is a child layout somwhere called mainlayout". | |
48 | QCOMPARE(dlg.fileWidget(), mFileWidget) ? More useful ;) | |
tests/kfilecustomdialogtest_gui.cpp | ||
27 | remove | |
tests/kfilecustomdialogtest_gui.h | ||
26 ↗ | (On Diff #23514) | unused, remove (remove the whole header...) |
autotests/kfilecustomdialogtest.h | ||
---|---|---|
31 | not really useful, in unittests (there's initTestcase which is better for initializations anyway) | |
src/filewidgets/kfilecustomdialog.h | ||
33 | API documentation rarely says "we". It uses a KFileWidget and allows the application to provide a custom widget. ... which will be shown where, BTW? Below the directory view and above the buttons? Or on the side? I see the implementation is KFileWidget::setCustomWidget so I could be less lazy and look that up, but the user of KFileCustomDialog wouldn't even know this anyway (unless the docu for setCustomWidget is improved to point there). | |
44 | Please reuse the documentation from KFileWidget, it's better. | |
69 | Is this needed? Does it need to be public? Why not connect to KFileWidget's slotOk directly? (or using a lambda) |
src/filewidgets/CMakeLists.txt | ||
---|---|---|
41 | nothing to see here | |
src/filewidgets/kfilecustomdialog.cpp | ||
66 | I wonder about the usefulness of these indirection methods, the only caller could do d->mFileWidget->setUrl(url), but well. Your choice :) (same for the 3 that follow, I don't see much benefit, but OK I don't see much harm either) | |
src/filewidgets/kfilecustomdialog.h | ||
62 | "element" seems weird here. Maybe something like this? @return the filewidget used inside this dialog |