summaryrefslogtreecommitdiff
path: root/vcl/qt5
AgeCommit message (Collapse)Author
2019-04-04Qt5 / KDE5 refactor create_SalInstanceJan-Marek Glogowski
Move most common code into Qt5Instance (static) functions. Not much saved with regard to LOC, but since the code was 95% C'n'P, I hope it'll be less error prone this way. Also handle all QApplication argument pointers via std::unique_ptr from the beginning. Change-Id: I87b2f571d398db7ccce3e740f16205b251be4ced Reviewed-on: https://gerrit.libreoffice.org/69578 Tested-by: Jenkins Reviewed-by: Aleksei Nikiforov <darktemplar@basealt.ru>
2019-04-04KDE5 merge KDE5SalData into Qt5DataJan-Marek Glogowski
Currently there is no point for a seperate KDE5 SalData class. The additional NWF settings fix the wrong popup menu for qt5, so this just moves all the NWF data and gets rid of KDE5SalData. Change-Id: I1c02d1f660df288a0d2e1c6607b34fc1ce593727 Reviewed-on: https://gerrit.libreoffice.org/70005 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-04-01tdf#120865: preserve cursor shape on repositioning the cursorKatarina Behrens
i.e. don't recreate cursor with new (default) arrow shape in SalFrame::SetPointerPos, but simply move the existing one Change-Id: I3406ceff25a53de6f2afa318114370c318e6a500 Reviewed-on: https://gerrit.libreoffice.org/70049 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-04-01Qt5 convert broken clippingJan-Marek Glogowski
localClipRegion was just set but never used, when KDE4 xlib blitting was replaced by Cairo / QPainter blitting. So this converts all the occurences to apply these clippings to the drawing QPainter instance. Change-Id: Ibfd60049ce604ac1415dc5c602ed5c952f972891 Reviewed-on: https://gerrit.libreoffice.org/70006 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-03-30tdf#122056: Catch DisposedExceptions everywhereKatarina Behrens
Change-Id: I6bdb9aa89a8a5181b096f47f90ab6fb5711e7447 Reviewed-on: https://gerrit.libreoffice.org/69541 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-03-30tdf#124292 Qt5 / KDE5 disable Qt's HiDPI scalingJan-Marek Glogowski
LO does its own layouting and also all the scaling, so disable the automatic HiDPI scaling explicitly. Otherwise fonts will be rendered in LoDPI and just scaled as an image, if UI scaling is enabled in KDE, resulting in really blocky / ugly fonts. Change-Id: I38503ce27c1671e80d0749d21c6c6dcff1a808a6 Reviewed-on: https://gerrit.libreoffice.org/69941 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-03-27tdf#124026: map window resizing-related cursors to their Qt equivalentsKatarina Behrens
there is no direct Qt equivalent of X11 xc_[top|bottom|left|right]_side cursors, but those come at least close Change-Id: Ifd442c46c08c71b1e1b9ddac42628b38eefee47f Reviewed-on: https://gerrit.libreoffice.org/69797 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-03-24tdf#124237 Qt5 get link colors from themeJan-Marek Glogowski
... which includes normal and visited link colors. Change-Id: Id53850c4700f71d007b59289b135d3c031348f2d Reviewed-on: https://gerrit.libreoffice.org/69591 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-03-23tdf#123072 Qt5 just use data from QFontDatabaseJan-Marek Glogowski
This way we can skip the intermediate QFont creation, which takes a much longer. The database information is actually sufficient. Change-Id: Ie5ab163edf6a1712d45b0738bb2e4822f2e3298c Reviewed-on: https://gerrit.libreoffice.org/69579 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-03-23tdf#123072 Qt5 don't register unknown PSP fontsJan-Marek Glogowski
LO's own font handling backend has some additional font styles, which are unknown to Qt, probably because it uses some stricter handling to decide which fonts are "usable", and because Qt seems to not know about some style types AFAIK. The main problem is QFontDatabase::addApplicationFont, as this seems to parse the whole font instead of a kind of registration, which takes ages for something like the Noto CJK style variants. As a workaround this drops the registration of all the additional PSP fonts. Both Qt5 and PSP use fontconfig but there is definitly some difference here, which needs to be resolved in some other way at some point. Change-Id: Id63cd0258ff56ee988323551820500b2c72a12be Reviewed-on: https://gerrit.libreoffice.org/69576 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-03-23Qt5 fix Qt5Instance::IsMainThread()Jan-Marek Glogowski
... and I was wondering why Qt5 didn't start anymore. Looks like it was already broken in my initial commit :-( Now there is also no more need for the KDE5SalInstance "variant". Change-Id: I035d31eaf191b3f2a4255869cea25394470d0dd0 Reviewed-on: https://gerrit.libreoffice.org/69577 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2019-03-22rhbz#1690732 basic font variation supportCaolán McNamara
on the fontconfig/harfbuzz/cairo drawing path for preset variations Change-Id: I95ef68aecfd59687ae9aae58e01e394c83c6ea9e Reviewed-on: https://gerrit.libreoffice.org/69505 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-03-19tdf#123379: implement native menu bar toggle on/offKatarina Behrens
qt5 didn't provide implementation of virtual SalMenu::ShowMenuBar so native menu bar was visible at all times. Hopefully notebookbar fans are happier now Change-Id: Ie581397521369160e16f40231bade40100dcd6f6 Reviewed-on: https://gerrit.libreoffice.org/69327 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-03-16tdf#119718: give focus where focus is dueKatarina Behrens
shamelessly copied X11SalFrame behaviour with different ToTopFlags: focus central widget with GrabFocus and GrabFocusOnly, activate window when coming back from minimized (RestoreWhenMin) or coming back to foreground (ForegroundTask) Change-Id: I4d43a00f0a9034e661303c39a1b522def85ab6f5 Reviewed-on: https://gerrit.libreoffice.org/69285 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-03-13tdf#123406 KDE5: Update delayed frame destructionAleksei Nikiforov
Move deleteLater() call to the different event loop. This fixes issue with frames not being disposed of deterministically, and previously opened window not reactivating. Also hide modal dialog window before unsetting modal mode. Unsetting modal mode may require to toggle window visibility. Window will be hidden soon anyway, and additional generated events might make finding correct focused window harder. Change-Id: Id7839f817075785287b09f6ac79eb3fb211726aa Reviewed-on: https://gerrit.libreoffice.org/68852 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-03-06loplugin:unnecessaryparen improve member expressionNoel Grandin
Change-Id: I304621018cb1e2a47e478e86df4229bcf2176741 Reviewed-on: https://gerrit.libreoffice.org/68757 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
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 Qt warning Qt5Frame::SetModal()Michael Stahl
This prints a warning "Cannot create children for a parent that is in a different thread"; let's fix it before it causes another hard to debug crash. 0 check_parent_thread(QObject*, QThreadData*, QThreadData*) (parent=parent@entry=0xe88ca0, parentThreadData=<optimized out>, currentThreadData=<optimized out>) at kernel/qobject.cpp:781 1 check_parent_thread (currentThreadData=<optimized out>, parentThreadData=<optimized out>, parent=0xe88ca0) at kernel/qobject.cpp:822 2 QObject::QObject(QObject*) (this=0x9ed2e80, parent=0xe88ca0) at kernel/qobject.cpp:810 3 Adwaita::GenericData::GenericData(QObject*, QWidget*, int) () at /usr/lib64/qt5/plugins/styles/adwaita.so 4 Adwaita::WidgetStateEngine::registerWidget(QWidget*, QFlags<Adwaita::AnimationMode>) () at /usr/lib64/qt5/plugins/styles/adwaita.so 5 Adwaita::Animations::registerWidget(QWidget*) const () at /usr/lib64/qt5/plugins/styles/adwaita.so 6 Adwaita::Style::polish(QWidget*) () at /usr/lib64/qt5/plugins/styles/adwaita.so 7 QWidget::event(QEvent*) () at /lib64/libQt5Widgets.so.5 8 Qt5Widget::event(QEvent*) (this=0x7321790, pEvent=0x7f90c27d3750) at vcl/qt5/Qt5Widget.cxx:416 9 QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5 10 QApplication::notify(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5 11 QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x7321790, event=0x7f90c27d3750) at kernel/qcoreapplication.cpp:1047 12 QWidget::ensurePolished() const () at /lib64/libQt5Widgets.so.5 13 QWidget::setVisible(bool) () at /lib64/libQt5Widgets.so.5 14 Qt5Frame::SetModal(bool) (this=0x9f411b0, bModal=true) at vcl/qt5/Qt5Frame.cxx:482 Change-Id: Ib6b4d1ee859dfce650422a6c7860abf2eb2686f1 Reviewed-on: https://gerrit.libreoffice.org/68356 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-03-05tdf#119856 vcl: Qt5/KDE5 RunInMainThreadMichael Stahl
The problem with the current approach of transferring calls to the main thread with Q_EMIT signals is that if the code that should run in the main thread needs SolarMutex, then the non-main-thread must use SolarMutexReleaser - but then the main thread will run not only the call that is needed right now, but will potentially process all pending events, and the other thread hasn't prepared for that. We need the inter-thread feature of Qt::BlockingQueuedConnection and the non-queued feature of Qt::DirectConnection, but this combination doesn't appear to exist. So the SolarMutexReleaser needs to go - but then the main thread does need SolarMutex for some things, and hence we need to trick it into believing it has SolarMutex with the m_bNoYieldLock hack. Then it becomes apparent that the main thread may be blocked on either Qt events, which is fine, or on the SalYieldMutex's m_aMutex, which will never be released now. So the main thread must never block on m_aMutex; the alternative is to use the same approach as the osx code (and, in a somewhat different form, the svp code), and add some condition variables on which the main thread can block if it fails to acquire the m_aMutex immediately. It's even possible to do this in a somewhat generic way with lambdas. This does appear to work, but it makes the Q_EMIT approach entirely untenable, because now the main thread will be blocked on the condition variable and the non-main-thread will be blocked until the Qt event is processed. Change-Id: I6480a6b909d5ec8814b2ff10dbefb0f3686a83c7 Reviewed-on: https://gerrit.libreoffice.org/68232 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-03-05tdf#120783: take suggested/preferred DnD ops into accountKatarina Behrens
use those for drag operation start in Qt5Widget and eventually to construct DropTargetDragEnterEvent Change-Id: I3a92cbe722dadc64f8a210f7fd4016c8eb17216b Reviewed-on: https://gerrit.libreoffice.org/68675 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-03-04tdf#120791: restore window geometry coming back from fullscreenKatarina Behrens
Change-Id: I1492423fe6110bdc79aa68c715e968770f6767ab Reviewed-on: https://gerrit.libreoffice.org/68672 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-03-04Unbreak internal DnD by using null MimeDataKatarina Behrens
Regression from 67b0fcea9d748c4dd8101036cbb2c587d65f0bf7 (which implements external DnD). QMimeData of internal DnD is never null, it always contains internal MimeType (but empty byte array) Change-Id: Ie12e9c3b7a3c7cebfd98064bb2fafec27c20a442 Reviewed-on: https://gerrit.libreoffice.org/68673 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-02-27tdf#122689 qt5: Consider external clipboard updatesMichael Weghorn
Previously, once 'm_aContents' had been assigned in 'VclQt5Clipboard::setContents()', its value (or the one set in a subsequent call to the same method) was always returned in 'VclQt5Clipboard::getContents()', thus ignoring all system clipboard updates done by any other third-party applications, preventing copy-paste from other applications. In order to take external clipboard updates into account, add a slot for the 'QClipboard::changed' signal and drop the current own clipboard content if the clipboard has been updated by another application. In order to detect whether the clipboard update was made by this 'VclQt5Clipboard' itself or elsewhere, a custom MIME type "application/x-libreoffice-clipboard-uuid" is added, whose value is set to the clipboard's (randomly generated) UUID. If the entry is present and has the correct value, the clipboard content was added by this clipboard and can be kept. Otherwise, clear 'm_aContents', so that it's newly assigned in 'VclQt5Clipboard::getContents()', taking into account the external clipboard update. [Side note: Testing showed that, on Wayland, more 'QClipboard::changed' events were emitted without the clipboard content actually having changed (e.g. when switching focus between windows), which is why an approach of simply setting a flag and checking for that one is not enough, like "wrapping" the 'QClipboard::setMimeData()' call in 'VclQt5Clipboard::setContents()' as follows m_bIsFillingClipboard = true; clipboard->setMimeData(pMimeData.release(), m_aClipboardMode); m_bIsFillingClipboard = false; and then evaluating the 'm_bIsfillingClipboard' flag in 'VclQt5Clipboard::handleClipboardChange' instead of using the UUID-based approach. These additional 'QClipboard::changed' events did not show up the same way while testing on X11.] Change-Id: Ib3a6a4f9b7f5ca3573666fb9c072ae97cf2e0049 Reviewed-on: https://gerrit.libreoffice.org/68214 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2019-02-27KDE5: set correct parent menu in functionAleksei Nikiforov
Set correct parent menu in function Qt5Menu::InsertMenuItem instead of just returning it and setting it later if needed. Change-Id: Id866987e91ec1d57c720735da6afc44109aa901a Reviewed-on: https://gerrit.libreoffice.org/68437 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2019-02-27tdf#121970 KDE5: Regenerate menu when it's set as submenuAleksei Nikiforov
Also add item bits change notification function for SalMenu to properly convert regenerated menu items to check or radiocheck items. Change-Id: I61f16a771b484644bbefd9afaf2776232d38a2f9 Reviewed-on: https://gerrit.libreoffice.org/68438 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2019-02-27tdf#104235: Qt5Frame: Set default iconMichael Weghorn
Set a default icon in Qt5Frame constructor, similar to how it's done for the gtk and gtk3 VCL plugins in 'GtkSalFrame::InitCommon'. Change-Id: I4e4e62ffa0eca6499f4752ff467d004cae68788f Reviewed-on: https://gerrit.libreoffice.org/68450 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2019-02-27tdf#123406 KDE5: Use delayed frame destructionAleksei Nikiforov
Destroy Qt5Frame after all events are received. Update Qt5Object to use delayed destruction too. Change-Id: I07c7251e097ad56f3616f325fdc394d00fec4f4f Reviewed-on: https://gerrit.libreoffice.org/68316 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2019-02-27tdf#119720 KDE5: Don't show hidden windows on modality changeAleksei Nikiforov
This change fixes clipping and drawing issues for document recovery window and other modal windows. Change-Id: I005254d4cd2598f4f2d02ba7e7bbf7388affe36c Reviewed-on: https://gerrit.libreoffice.org/68307 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2019-02-26tdf#120824 KDE5: fix visible/enabled state for menuAleksei Nikiforov
Change-Id: I003703f0bc2e1697124e068a68bfb2e24c33cd1a Reviewed-on: https://gerrit.libreoffice.org/68351 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2019-02-26sal_uIntPtr->sal_uInt32 inSalClipRegion::BeginSetClipRegionNoel Grandin
sal_uInt32 seems reasonable given that this is the number of rectanges in an image. And then convert all of the other BeginSetClipRegion methods to use sal_uInt32 too. Change-Id: I85a712ec823662ac30f3859051e2b974fb99775e Reviewed-on: https://gerrit.libreoffice.org/68343 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-26sal_uIntPtr->sal_uInt64 in SalTimer::StartNoel Grandin
because the call site specifies millis in a sal_uInt64 variable Change-Id: I5cf42407b9e7f3cdef976d8f442609723fd67af9 Reviewed-on: https://gerrit.libreoffice.org/68342 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-26sal_uLong->sal_uInt32 in drawEPSNoel Grandin
Change-Id: I58beedfee1a55df971e778ba2aa3b6989ba53663 Reviewed-on: https://gerrit.libreoffice.org/68341 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-22tdf#122256 KDE5: Make menubar work for windows with parentsAleksei Nikiforov
Change-Id: I325faec8594e1c5b8b2c34a135f1604244e4826c Reviewed-on: https://gerrit.libreoffice.org/68140 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.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-15tdf#123451 qt5: Detect decimal separator on keypadMichael Weghorn
'QtKeyEvent::key()' doesn't return a special value for the decimal separator key on the keypad ("," or "."), but just returns 'Qt::Key_Comma' or 'Qt::Key_Period'. However, the 'Qt::KeypadModifier' modifier is set in this case, so check for this one in addition and return 'KEY_DECIMAL' if those are combined. Change-Id: Ia80826e2ad5e47a1f49bef450168523d766c1d6a Reviewed-on: https://gerrit.libreoffice.org/67886 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2019-02-13tdf#120787: fine-tune window flags w/ focus on floating toolbarsKatarina Behrens
Floating toolbars are tool windows (Qt::Tool, not Qt::Window which has a separate taskbar entry). They are frameles (Qt::FramelessWindowHint) bc LibO takes care of drawing window decorations itself. They also must be able to receive keyboard focus (remove Qt::WindowDoesNotAcceptFocus) Change-Id: I61e8a905fdc4fde1a64df5a0824d358036cfcdea Reviewed-on: https://gerrit.libreoffice.org/67768 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-02-13tdf#120786: show undocked toolbar only when it's readyKatarina Behrens
in SetAlwaysOnTop set window flags only, don't show the widget yet (it'll be shown later, when it can be painted in full) Change-Id: I5e855f1ebba1eb9985744ece055a0f141e965940 Reviewed-on: https://gerrit.libreoffice.org/67739 Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de> Tested-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-02-12loplugin:unnecessaryparenStephan Bergmann
Change-Id: Ibd47c9b9dfcd33527739a7e7bbabb21f7af24ed7
2019-02-11tdf#119853: Set window state only, don't actually show the windowKatarina Behrens
showMaximized, showNormal etc. makes the windows visible, but it is not always desirable (e.g. documents opened with 'hidden' flag on) Change-Id: I15364c816c35865dbc2d74f1d1a46817b1277f43 Reviewed-on: https://gerrit.libreoffice.org/67679 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-02-08o3tl::make_unique -> std::make_unique in tools..xmloffGabor Kelemen
Since it is now possible to use C++14, it's time to replace the temporary solution with the standard one Change-Id: Ib3201f865d43f372007cdf381c7e244e9cbeae26 Reviewed-on: https://gerrit.libreoffice.org/67474 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
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>
2019-02-02tdf#120772: DnD of multiple URLs from file manager -> LibOKatarina Behrens
Change-Id: I8d6fc446eff46fd6ab1152a3af836df891dde52a Reviewed-on: https://gerrit.libreoffice.org/67277 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>