summaryrefslogtreecommitdiff
path: root/vcl/qt5/Qt5FilePicker.cxx
AgeCommit message (Collapse)Author
2019-09-28loplugin:constmethod in vclNoel Grandin
Change-Id: I6a456979a6cfcd7920dc468baf9b23013cb701a4 Reviewed-on: https://gerrit.libreoffice.org/79783 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-18tdf#88205 Adapt uses of css::uno::Sequence to use initializer_list ctorJulien Nabet
in vcl Change-Id: Ibd66e5ed9064612b73d08fac179ee46dc5b0a4b6 Reviewed-on: https://gerrit.libreoffice.org/77656 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-08-15loplugin:sequenceloop in unoxml..vclNoel Grandin
Change-Id: Ic3c48ec4d86252b62d3dd25bbc198f7d7fb75e90 Reviewed-on: https://gerrit.libreoffice.org/77533 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-31Improved loplugin:stringconstant (now that GCC 7 supports it): vclStephan Bergmann
Change-Id: I0bd1d26f6fc4052b812fde33ebd1d63111426942 Reviewed-on: https://gerrit.libreoffice.org/76627 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-06-19tdf#125971: map file URLs from QFileDialog to LO internal formatStephan Bergmann
jmux' suggestion at <https://bugs.documentfoundation.org/show_bug.cgi?id=125971#c7> turns out to be the correct fix after all; explained in a lengthy comment why that seemingly wrong call of translateToInternal happens to do the right thing. (Much of this patch is about passing the XComponentContext down to where it is now needed in Qt5FilePicker::getSelectedFiles.) Change-Id: I235554f8494cd3094a011d5a903059326db499fc Reviewed-on: https://gerrit.libreoffice.org/74359 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-03-05tdf#119856 vcl: convert Qt5FilePicker and Qt5Menu to RunInMainThreadMichael Stahl
... and also convert KDE5FilePicker. And Qt5Frame. The UNO methods in Qt5FilePicker/KDE5FilePicker have to ensure that the thread actually owns SolarMutex, because if RunInMainThread() is called without that it will deadlock. Change-Id: Ie4d2f494ac81c799ec7c9a3acb3a9b0f77bb6361 Reviewed-on: https://gerrit.libreoffice.org/68357 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-03-05tdf#119856 vcl: fix Qt5FilePicker destructor to run in main threadMichael Stahl
During QFileDialog dtor, QSocketNotifier::setEnabled(false) is called, but it doesn't do anything other than print a stupid warning and so it's still registered and later it receives events after it's dead. 0 QSocketNotifier::setEnabled(bool) (this=this@entry=0x991c058, enable=enable@entry=false) at kernel/qsocketnotifier.cpp:240 1 QInotifyFileSystemWatcherEngine::~QInotifyFileSystemWatcherEngine() (this=0x991c030, __in_chrg=<optimized out>) at io/qfilesystemwatcher_inotify.cpp:260 2 QInotifyFileSystemWatcherEngine::~QInotifyFileSystemWatcherEngine() (this=0x991c030, __in_chrg=<optimized out>) at io/qfilesystemwatcher_inotify.cpp:258 3 QObjectPrivate::deleteChildren() (this=this@entry=0x991c240) at kernel/qobject.cpp:1997 4 QObject::~QObject() (this=<optimized out>, __in_chrg=<optimized out>) at kernel/qobject.cpp:1025 5 QFileSystemWatcher::~QFileSystemWatcher() (this=0x9641b60, __in_chrg=<optimized out>) at io/qfilesystemwatcher.cpp:277 6 QObjectPrivate::deleteChildren() (this=this@entry=0x2a30130) at kernel/qobject.cpp:1997 7 QObject::~QObject() (this=<optimized out>, __in_chrg=<optimized out>) at kernel/qobject.cpp:1025 8 QThread::~QThread() (this=0x2a079b8, __in_chrg=<optimized out>) at thread/qmutex.h:217 9 () at /lib64/libQt5Widgets.so.5 10 QScopedPointerDeleter<QObjectData>::cleanup(QObjectData*) (pointer=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:52 11 QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::~QScopedPointer() (this=0x98aa4d8, __in_chrg=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:107 12 QObject::~QObject() (this=<optimized out>, __in_chrg=<optimized out>) at kernel/qobject.cpp:884 13 QFileSystemModel::~QFileSystemModel() () at /lib64/libQt5Widgets.so.5 14 QObjectPrivate::deleteChildren() (this=0x97bab00) at kernel/qobject.cpp:1997 15 QWidget::~QWidget() () at /lib64/libQt5Widgets.so.5 16 QFileDialog::~QFileDialog() () at /lib64/libQt5Widgets.so.5 17 std::default_delete<QFileDialog>::operator()(QFileDialog*) const (this=0x9770f90, __ptr=0x926e970) at /usr/include/c++/8/bits/unique_ptr.h:81 18 std::unique_ptr<QFileDialog, std::default_delete<QFileDialog> >::~unique_ptr() (this=0x9770f90, __in_chrg=<optimized out>) at /usr/include/c++/8/bits/unique_ptr.h:274 19 Qt5FilePicker::~Qt5FilePicker() (this=0x9770ed0, __in_chrg=<optimized out>) at vcl/qt5/Qt5FilePicker.cxx:155 Change-Id: Iddfa3d44de59e1760e20a389566d9e6815ab26f7 Reviewed-on: https://gerrit.libreoffice.org/68355 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-02-20kde5 fpicker: Reuse 'initialize()' from base classMichael Weghorn
Take over missing case from 'KDE5FilePicker::initialize' to 'Qt5FilePicker::initialize' and make 'Qt5FilePicker::addCustomControl' virtual, so that the subclass's implementation is called in the 'initialize()' method (in particular to avoid adding another autoextension checkbox). Drop the 'KDE5FilePicker::initialize' so that the base class implementation is used, which now does the same thing. Add 'override' keyword in KDE5Filepicker.hxx. Change-Id: Id151a4d4862af4275f6c21c6537a79c52e3ed513 Reviewed-on: https://gerrit.libreoffice.org/68059 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-02-20Make 'setDefaultName()' work again for kde5 fpickerMichael Weghorn
Add an option to Qt5FilePicker constructor to say whether the QFileDialog should be a native one or not, since 'QFileDialog::selectFile' does not preselect the correct name in the native dialog any more if the 'QFileDialog::DontUseNativeDialog' option has ever been set, i.e. QFileDialog fileDialog; fileDialog.setOption(QFileDialog::DontUseNativeDialog); fileDialog.setOption(QFileDialog::DontUseNativeDialog, false); fileDialog.selectFile("test.txt"); will not properly set the name in the native file dialog, which broke 'setDefaultName' for the KDE5FilePicker. This makes it work again, even though I think that the underlying issue is a Qt bug (s. https://bugreports.qt.io/browse/QTBUG-73682 ). Change-Id: I99a1e7c97d594925d600fa8eaf3303f9013551c2 Reviewed-on: https://gerrit.libreoffice.org/68058 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-02-20Qt5FilePicker::addCustomControl: Add missing from kde5Michael Weghorn
Take over functionality from 'KDE5FilePicker::addCustomControl' that has not been implemented in qt5 one yet. Change-Id: I9690e163b3b739bfec6813d9a4e1e0170b730187 Reviewed-on: https://gerrit.libreoffice.org/68056 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-02-20kde5 fpicker: Reuse existing handle{G,S}etListValueMichael Weghorn
Turn existing functions in Qt5FilePicker into protected static class methods and reuse them in KDE5FilePicker. The qt5 implementation covers everything that kde5 had, and a little more (e.g. covers case 'ControlActions::DELETE_ITEM' in 'handleSetListValue' as well). Change-Id: I9673b20e3313c0628a76f0d94e018327f4af8523 Reviewed-on: https://gerrit.libreoffice.org/68054 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-02-20KDE5FilePicker: Reuse XFilter{,Group}Manager methods from qt5Michael Weghorn
The non-native QFileDialog automatically adds the file extension for the selected filter in the listbox, therefore it was stripped from the filter title in 'Qt5FilePicker::appendFilter'. Since the native Plasma/kde5 file dialog does not add it automatically, introduce a new member 'm_bShowFileExtensionInFilterTitle' to specify whether or not to strip the extension and set it accordingly in KDE5FilePicker (so that it continues to show e.g. "ODF Text Document (.odt)" instead of just "ODF Text Document"). This allows for KDE5FilePicker to reuse the base class implementation and thus to drop all related own members and methods. Change-Id: Icfb77d065160d3f655e3e89ad69de4195781373a Reviewed-on: https://gerrit.libreoffice.org/68052 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-02-20kde5 fpicker: Drop 'getFiles' and 'getSelectedFiles'Michael Weghorn
... and related signals/slots. Those from the Qt5FilePicker base class do the same thing, except for one 'SolarMutexReleaser' that was commented out in 'KDE5FilePicker::getFiles' for no apparent reason since that line was added in commit 8fb0881a3e5b2. Take over the slightly nicer syntax for the range-based for loop from 'KDE5FilePicker::getSelectedFiles' to 'Qt5FilePicker::getSelectedFiles'. Change-Id: I419f933d256f3b85eccaea85803b4890770efa24 Reviewed-on: https://gerrit.libreoffice.org/68046 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-02-20qt5/kde5: Reuse QFileDialog from Qt5Filepicker in kde5Michael Weghorn
Drop the '_dialog' member from KDE5FileDialog and use the one from Qt5FileDialog instead. Move up 'm_bIsFolderPicker' to Qt5FilePicker. Also, move some of the related functionality from the kde5 file picker to the qt5 one, in particular take over missing parts from 'KDE5FilePicker::setMultiSelectionMode' to 'Qt5FilePicker::setMultiSelectionMode' and drop the former (now inherited from the base class). This e.g. also makes sure that only folders are available for selection when using a FolderPicker in qt5 (e.g. in the dialog to add a JRE in "Tools" -> "Options" -> "Advanced"). The functionality had only been implemented for kde5 beforehand. Since the QFileDialog is set to non-native mode in Qt5FilePicker constructor, native mode needs to be excplicitly enabled again for kde5. Since Qt's signal/slot mechanism is used to connect signals on the object in both constructors (Qt5FilePicker/KDE5FilePicker), some events will trigger multiple actions. This will be taken care of in subsequent commits, along with further refactoring. Change-Id: I245d46c12945acb91c9b52dcff5c83248ac087dd Reviewed-on: https://gerrit.libreoffice.org/68042 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-02-05tdf#123058 qt5 fpicker: Honor autoextension settingMichael Weghorn
Store the file extension associated with the named filters in a map, and use that information to set the default file extension in QFileDialog accordingly if the corresponding checkbox in the dialog is enabled. Change-Id: I66f4f35da5d4378ac6337429e39260a4ed710a24 Reviewed-on: https://gerrit.libreoffice.org/67392 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2019-02-05qt5 fpicker: Fix initial directory selectionMichael Weghorn
This takes over the fix from the KDE5FilePicker from commit 1af4ab72e2488515fcaedeb4a377ee070d68a495 for the qt5 one. Change-Id: Ibe34ecff9913fc91df2b9bd25b559375bab0ff83 Reviewed-on: https://gerrit.libreoffice.org/67385 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2018-12-19Qt5: remove assert leading to crash while executing 'open' dialogAleksei Nikiforov
When Writer is opened using "qt5" VCL plugin, opening menu item "File" -> "Open" leads to a crash due to presence of mentioned assert. Impress crashes same way when same menu item is used. Change-Id: I9d1937344c694d4f4620be1b71d1181eb9645427 Reviewed-on: https://gerrit.libreoffice.org/65344 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-09-17Qt5 just implement a non-native file pickerJan-Marek Glogowski
Since there is no way to retrieve the embedded native file dialog from the Qt5 platfor abstraction, force the dialog in non-native mode. This drops the 2nd option dialog completely. While at it implement handling of the optional combo boxes in the dialog. Change-Id: I8d11e929a5f3b142dc0f5653fcc576231a1b0392 Reviewed-on: https://gerrit.libreoffice.org/60569 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-07-31Add missing sal/log.hxx headersGabor Kelemen
rtl/string.hxx and rtl/ustring.hxx both unnecessarily #include <sal/log.hxx> (and don't make use of it themselves), but many other files happen to depend on it. This is a continuation of commit 6ff2d84ade299cb3d14d4110e4cf1a4b8070c030 to be able to remove those unneeded includes. This commit adds missing headers to every file found by: grep -FwL sal/log.hxx $(git grep -Elw 'SAL_INFO|SAL_INFO_IF|SAL_WARN|SAL_WARN_IF|SAL_DETAIL_LOG_STREAM|SAL_WHERE|SAL_STREAM|SAL_DEBUG') to directory vcl Change-Id: I205fe0f4e80a66cd9c3b19f7e9716411da1d1cf5 Reviewed-on: https://gerrit.libreoffice.org/58221 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-06-01Various trivial loplugin fixes in --enable-qt5Stephan Bergmann
Change-Id: I9539eb77f663e1174919ae801495801f81571710
2018-06-01Make clang-format happy, remove vcl/unx/kde5 from blacklistKatarina Behrens
just between us girls, I hate you clang-format Change-Id: I4cd041eff7a9fa01eb9192cf357e3f07a26fa6ad
2018-06-01Templatize Qt5Widget classKatarina Behrens
to distinguish between QMainWindow (top-level SalFrame) and QWidget (everything else). The former are going to receive a native menu Change-Id: I9023d1e464345f96f13967f5e2c8b0716890fbc9
2018-06-01Qt5 minimal "native" file pickerJan-Marek Glogowski
Change-Id: I99d8213d23b09b6cb1e398359ad05c8fa702a8e0