vcl/Library_vclplug_kde5.mk | 2 vcl/unx/kde5/FPServiceInfo.hxx | 28 ------------- vcl/unx/kde5/KDE5FilePicker.cxx | 59 ---------------------------- vcl/unx/kde5/KDE5FilePicker2.cxx | 26 +++++++++++- vcl/unx/kde5/VCLKDE5Application.cxx | 75 ------------------------------------ vcl/unx/kde5/VCLKDE5Application.hxx | 41 ------------------- 6 files changed, 24 insertions(+), 207 deletions(-)
New commits: commit 5a3ee6623c161838ddc1ebf65ac6be3eece5be09 Author: Katarina Behrens <katarina.behr...@cib.de> Date: Mon Jun 18 11:24:36 2018 +0200 VCLKDE5Application is now unused as well Change-Id: Ib11274b6039596246aa232b83fa4d85095a93e08 diff --git a/vcl/Library_vclplug_kde5.mk b/vcl/Library_vclplug_kde5.mk index 11fa740926e4..4d134d0fbf8b 100644 --- a/vcl/Library_vclplug_kde5.mk +++ b/vcl/Library_vclplug_kde5.mk @@ -84,7 +84,6 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_kde5,\ vcl/unx/kde5/KDE5SalFrame \ vcl/unx/kde5/KDE5SalGraphics \ vcl/unx/kde5/KDE5SalInstance \ - vcl/unx/kde5/VCLKDE5Application \ )) ifeq ($(OS),LINUX) diff --git a/vcl/unx/kde5/VCLKDE5Application.cxx b/vcl/unx/kde5/VCLKDE5Application.cxx deleted file mode 100644 index 2d9532f1def9..000000000000 --- a/vcl/unx/kde5/VCLKDE5Application.cxx +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "VCLKDE5Application.hxx" - -#include <QtGui/QClipboard> -#include <QtCore/QEvent> -#include <assert.h> - -VCLKDE5Application::VCLKDE5Application(int argc, char** argv) - : QApplication(argc, argv) -{ -} - -// various hacks to be performed before re-entering Qt's event loop -// because of showing a Qt dialog -void VCLKDE5Application::preDialogSetup() -{ - // KFileDialog integration requires using event loop with QClipboard. - // Opening the KDE file dialog here can lead to QClipboard - // asking for clipboard contents. If LO core is the owner of the clipboard - // content, without event loop use this will block for 5 seconds and timeout, - // since the clipboard thread will not be able to acquire SolarMutex - // and thus won't be able to respond. If the event loops - // are properly integrated and QClipboard can use a nested event loop - // (see the KDE VCL plug), then this won't happen. - // We cannot simply release SolarMutex here, because the event loop started - // by the file dialog would also call back to LO code. - assert(QApplication::clipboard()->property("useEventLoopWhenWaiting").toBool()); -} - -// various hacks to be performed after a Qt dialog has been closed -void VCLKDE5Application::postDialogCleanup() -{ - // HACK: KFileDialog uses KConfig("kdeglobals") for saving some settings - // (such as the auto-extension flag), but that doesn't update KGlobal::config() - // (which is probably a KDE bug), so force reading the new configuration, - // otherwise the next opening of the dialog would use the old settings. - KConfig config; - config.reparseConfiguration(); - // HACK: If Qt owns clipboard or selection, give up on their ownership now. Otherwise - // LO core might ask for the contents, but it would block while doing so (i.e. it - // doesn't seem to have an equivalent of QClipboard's "useEventLoopWhenWaiting"), - // therefore QClipboard wouldn't be able to respond, and whole LO would block until - // a timeout. Given that Klipper is most probably running, giving up clipboard/selection - // ownership will not only avoid the blocking, but even pasting that content in LO - // will in fact work, if Klipper can handle it. - // Technically proper solution would be of course to allow Qt to process QClipboard - // events while LO waits for clipboard contents, or short-circuit to QClipboard somehow - // (it's a mystery why LO's clipboard handling has its own thread when whole LO can - // get blocked by both trying to send and receive clipboard contents anyway). - QClipboard* clipboard = QApplication::clipboard(); - if (clipboard->ownsSelection()) - clipboard->clear(QClipboard::Selection); - if (clipboard->ownsClipboard()) - clipboard->clear(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde5/VCLKDE5Application.hxx b/vcl/unx/kde5/VCLKDE5Application.hxx deleted file mode 100644 index 5503db32c901..000000000000 --- a/vcl/unx/kde5/VCLKDE5Application.hxx +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_VCL_UNX_KDE5_VCLKDE5APPLICATION_HXX -#define INCLUDED_VCL_UNX_KDE5_VCLKDE5APPLICATION_HXX - -#pragma once - -#include <QtWidgets/QApplication> -#include <QtCore/QAbstractNativeEventFilter> -#include <KConfigCore/kconfig.h> - -#undef Region - -class VCLKDE5Application : public QApplication, public QAbstractNativeEventFilter -{ -public: - VCLKDE5Application(int argc, char** argv); - static void preDialogSetup(); - static void postDialogCleanup(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit a8b1c4bec0c65288adf4282d032a02bfeae6160f Author: Katarina Behrens <katarina.behr...@cib.de> Date: Mon Jun 18 11:15:02 2018 +0200 Drop cargo-cult FPServiceInfo FILE_PICKER_SERVICE_NAME wasn't even used anywhere Change-Id: Ie99de85175b8321948612c680c4e4d956a4c7efc diff --git a/vcl/unx/kde5/FPServiceInfo.hxx b/vcl/unx/kde5/FPServiceInfo.hxx deleted file mode 100644 index ec58684d4919..000000000000 --- a/vcl/unx/kde5/FPServiceInfo.hxx +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -// the service names -#define FILE_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.KDE4FilePicker" - -// the implementation names -#define FILE_PICKER_IMPL_NAME "com.sun.star.ui.dialogs.KDE4FilePicker" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde5/KDE5FilePicker2.cxx b/vcl/unx/kde5/KDE5FilePicker2.cxx index 778608e1edb9..ce8af6a7eaf2 100644 --- a/vcl/unx/kde5/KDE5FilePicker2.cxx +++ b/vcl/unx/kde5/KDE5FilePicker2.cxx @@ -31,7 +31,6 @@ #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <osl/mutex.hxx> -#include "FPServiceInfo.hxx" #undef Region @@ -664,7 +663,7 @@ void KDE5FilePicker::disposing(const lang::EventObject& rEvent) OUString SAL_CALL KDE5FilePicker::getImplementationName() { - return OUString(FILE_PICKER_IMPL_NAME); + return OUString("com.sun.star.ui.dialogs.KDE5FilePicker"); } sal_Bool SAL_CALL KDE5FilePicker::supportsService(const OUString& ServiceName) commit c55dd17d686c000946a5cb4bc4cec23768c54757 Author: Katarina Behrens <katarina.behr...@cib.de> Date: Mon Jun 18 10:36:50 2018 +0200 Fold all the rest into KDE5FilePicker2 Change-Id: Icbaa56057776ffcb981207ec30e5d94d6901e43c diff --git a/vcl/Library_vclplug_kde5.mk b/vcl/Library_vclplug_kde5.mk index 655ae6b80d96..11fa740926e4 100644 --- a/vcl/Library_vclplug_kde5.mk +++ b/vcl/Library_vclplug_kde5.mk @@ -79,7 +79,6 @@ $(eval $(call gb_Library_add_libs,vclplug_kde5,\ )) $(eval $(call gb_Library_add_exception_objects,vclplug_kde5,\ - vcl/unx/kde5/KDE5FilePicker \ vcl/unx/kde5/KDE5FilePicker2 \ vcl/unx/kde5/KDE5SalData \ vcl/unx/kde5/KDE5SalFrame \ diff --git a/vcl/unx/kde5/KDE5FilePicker.cxx b/vcl/unx/kde5/KDE5FilePicker.cxx deleted file mode 100644 index 19bea46654a3..000000000000 --- a/vcl/unx/kde5/KDE5FilePicker.cxx +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "KDE5FilePicker.hxx" - -#include <KWindowSystem> -#include <KFileWidget> - -#include <QtCore/QDebug> -#include <QtCore/QUrl> -#include <QtGui/QClipboard> -#include <QtGui/QWindow> -#include <QtWidgets/QCheckBox> -#include <QtWidgets/QFileDialog> -#include <QtWidgets/QGridLayout> -#include <QtWidgets/QWidget> -#include <QtWidgets/QApplication> - -// KDE5FilePicker - -KDE5FilePicker::~KDE5FilePicker() -{ - delete _extraControls; - delete _dialog; -} - -bool KDE5FilePicker::eventFilter(QObject* o, QEvent* e) -{ - if (e->type() == QEvent::Show && o->isWidgetType()) - { - auto* w = static_cast<QWidget*>(o); - if (!w->parentWidget() && w->isModal()) - { - if (auto* fileWidget = w->findChild<KFileWidget*>({}, Qt::FindDirectChildrenOnly)) - fileWidget->setCustomWidget(_extraControls); - } - } - return QObject::eventFilter(o, e); -} - -#include <KDE5FilePicker.moc> - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde5/KDE5FilePicker2.cxx b/vcl/unx/kde5/KDE5FilePicker2.cxx index b7c3320344bf..778608e1edb9 100644 --- a/vcl/unx/kde5/KDE5FilePicker2.cxx +++ b/vcl/unx/kde5/KDE5FilePicker2.cxx @@ -48,6 +48,7 @@ #include <QtWidgets/QGridLayout> #include <QtWidgets/QWidget> #include <QtWidgets/QApplication> +#include <KFileWidget> #include <fpicker/strings.hrc> #include <strings.hrc> @@ -141,6 +142,12 @@ KDE5FilePicker::KDE5FilePicker(QFileDialog::FileMode eMode) qApp->installEventFilter(this); } +KDE5FilePicker::~KDE5FilePicker() +{ + delete _extraControls; + delete _dialog; +} + void SAL_CALL KDE5FilePicker::addFilePickerListener(const uno::Reference<XFilePickerListener>& xListener) { @@ -687,4 +694,20 @@ void KDE5FilePicker::selectionChanged() m_xListener->fileSelectionChanged(aEvent); } +bool KDE5FilePicker::eventFilter(QObject* o, QEvent* e) +{ + if (e->type() == QEvent::Show && o->isWidgetType()) + { + auto* w = static_cast<QWidget*>(o); + if (!w->parentWidget() && w->isModal()) + { + if (auto* fileWidget = w->findChild<KFileWidget*>({}, Qt::FindDirectChildrenOnly)) + fileWidget->setCustomWidget(_extraControls); + } + } + return QObject::eventFilter(o, e); +} + +#include <KDE5FilePicker.moc> + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits