From 410bf59de02192c2daf1158b9de76ec0ebab4c56 Mon Sep 17 00:00:00 2001 From: Thorsten Behrens Date: Wed, 5 Sep 2018 02:53:07 +0200 Subject: kde5: remove older kde/tde plugins, and references to that KDE4 is out of maintenance upstream since Nov. 2014, and binaries provided by TDF have switched to KDE5 as the official backend. Change-Id: I165465b56d3ba3a18912b203c06ae8fc6111c0c9 Reviewed-on: https://gerrit.libreoffice.org/60014 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens --- Repository.mk | 8 +- RepositoryExternal.mk | 27 - bin/check-elf-dynamic-objects | 4 - bin/distro-install-file-lists | 6 - config_host.mk.in | 6 - config_host/config_kde4.h.in | 10 - config_host/config_vclplug.h.in | 1 - configure.ac | 322 ------ cppuhelper/source/servicemanager.cxx | 8 - cui/Library_cui.mk | 1 - cui/source/options/optgdlg.cxx | 6 +- .../Jenkins/LibreOfficeLinuxUpdater.conf | 2 +- distro-configs/Jenkins/Linux_dev_master.conf | 2 +- distro-configs/Jenkins/Linux_rel_master.conf | 2 +- distro-configs/LibreOfficeCoverity.conf | 2 +- distro-configs/LibreOfficeLinux.conf | 2 +- distro-configs/LibreOfficeOpenBSD.conf | 3 +- distro-configs/LibreOfficeiOS.conf | 2 +- include/sal/log-areas.dox | 1 - postprocess/Rdb_services.mk | 3 - scp2/InstallScript_setup_osl.mk | 2 +- scp2/Module_scp2.mk | 2 +- shell/Library_kde4be.mk | 32 - shell/Module_shell.mk | 6 - shell/source/backends/desktopbe/desktopbackend.cxx | 16 +- shell/source/backends/kde4be/kde4access.cxx | 300 ------ shell/source/backends/kde4be/kde4access.hxx | 39 - shell/source/backends/kde4be/kde4backend.cxx | 180 ---- shell/source/backends/kde4be/kde4be1.component | 25 - solenv/gbuild/CppunitTest.mk | 1 - svtools/source/uno/fpicker.cxx | 12 +- sysui/CustomTarget_share.mk | 2 - vcl/CustomTarget_kde4_moc.mk | 24 - vcl/Library_vclplug_kde4.mk | 99 -- vcl/Module_vcl.mk | 7 - vcl/README | 6 +- vcl/README.scheduler | 4 +- vcl/inc/vclpluginapi.h | 6 - vcl/source/app/salplug.cxx | 5 +- vcl/source/opengl/OpenGLHelper.cxx | 2 +- vcl/unx/kde4/FPServiceInfo.hxx | 28 - vcl/unx/kde4/KDE4FilePicker.cxx | 823 ---------------- vcl/unx/kde4/KDE4FilePicker.hxx | 258 ----- vcl/unx/kde4/KDEData.cxx | 68 -- vcl/unx/kde4/KDEData.hxx | 37 - vcl/unx/kde4/KDESalDisplay.cxx | 91 -- vcl/unx/kde4/KDESalDisplay.hxx | 45 - vcl/unx/kde4/KDESalFrame.cxx | 373 ------- vcl/unx/kde4/KDESalFrame.hxx | 53 - vcl/unx/kde4/KDESalGraphics.cxx | 1025 -------------------- vcl/unx/kde4/KDESalGraphics.hxx | 53 - vcl/unx/kde4/KDESalInstance.cxx | 66 -- vcl/unx/kde4/KDESalInstance.hxx | 45 - vcl/unx/kde4/KDEXLib.cxx | 426 -------- vcl/unx/kde4/KDEXLib.hxx | 101 -- vcl/unx/kde4/VCLKDEApplication.cxx | 87 -- vcl/unx/kde4/VCLKDEApplication.hxx | 39 - vcl/unx/kde4/main.cxx | 89 -- vcl/unx/kde4/tst_exclude_posted_events.hxx | 67 -- vcl/unx/kde4/tst_exclude_socket_notifiers.hxx | 80 -- vcl/unx/kde5/KDE5FilePicker2.cxx | 3 +- vcl/unx/kde5/KDE5SalInstance.cxx | 1 - 62 files changed, 30 insertions(+), 5016 deletions(-) delete mode 100644 config_host/config_kde4.h.in delete mode 100644 shell/Library_kde4be.mk delete mode 100644 shell/source/backends/kde4be/kde4access.cxx delete mode 100644 shell/source/backends/kde4be/kde4access.hxx delete mode 100644 shell/source/backends/kde4be/kde4backend.cxx delete mode 100644 shell/source/backends/kde4be/kde4be1.component delete mode 100644 vcl/CustomTarget_kde4_moc.mk delete mode 100644 vcl/Library_vclplug_kde4.mk delete mode 100644 vcl/unx/kde4/FPServiceInfo.hxx delete mode 100644 vcl/unx/kde4/KDE4FilePicker.cxx delete mode 100644 vcl/unx/kde4/KDE4FilePicker.hxx delete mode 100644 vcl/unx/kde4/KDEData.cxx delete mode 100644 vcl/unx/kde4/KDEData.hxx delete mode 100644 vcl/unx/kde4/KDESalDisplay.cxx delete mode 100644 vcl/unx/kde4/KDESalDisplay.hxx delete mode 100644 vcl/unx/kde4/KDESalFrame.cxx delete mode 100644 vcl/unx/kde4/KDESalFrame.hxx delete mode 100644 vcl/unx/kde4/KDESalGraphics.cxx delete mode 100644 vcl/unx/kde4/KDESalGraphics.hxx delete mode 100644 vcl/unx/kde4/KDESalInstance.cxx delete mode 100644 vcl/unx/kde4/KDESalInstance.hxx delete mode 100644 vcl/unx/kde4/KDEXLib.cxx delete mode 100644 vcl/unx/kde4/KDEXLib.hxx delete mode 100644 vcl/unx/kde4/VCLKDEApplication.cxx delete mode 100644 vcl/unx/kde4/VCLKDEApplication.hxx delete mode 100644 vcl/unx/kde4/main.cxx delete mode 100644 vcl/unx/kde4/tst_exclude_posted_events.hxx delete mode 100644 vcl/unx/kde4/tst_exclude_socket_notifiers.hxx diff --git a/Repository.mk b/Repository.mk index 12a104dd0eab..9fed0b942c91 100644 --- a/Repository.mk +++ b/Repository.mk @@ -294,18 +294,16 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,gnome, \ )) $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,kde, \ - $(if $(ENABLE_KDE4),kde4be1) \ $(if $(ENABLE_KDE5),kde5be1) \ $(if $(USING_X11), \ - $(if $(ENABLE_KDE4),vclplug_kde4) \ - $(if $(ENABLE_KDE5),vclplug_kde5) \ + $(if $(ENABLE_KDE5),vclplug_kde5) \ $(if $(ENABLE_QT5),vclplug_qt5) \ - $(if $(ENABLE_GTK3_KDE5),vclplug_gtk3_kde5) \ + $(if $(ENABLE_GTK3_KDE5),vclplug_gtk3_kde5) \ ) \ )) ifneq ($(ENABLE_GTK3_KDE5),) $(eval $(call gb_Helper_register_executables_for_install,OOO,kde, \ - lo_kde5filepicker \ + lo_kde5filepicker \ )) endif diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index f7ecf3c3c010..346e7fe1ab42 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -3071,33 +3071,6 @@ endef endif # SYSTEM_POSTGRESQL -ifeq ($(ENABLE_KDE4),TRUE) - -define gb_LinkTarget__use_kde4 -$(call gb_LinkTarget_set_include,$(1),\ - $(subst -isystem/,-isystem /,$(filter -I% -isystem%,$(subst -isystem /,-isystem/,$(KDE4_CFLAGS)))) \ - $$(INCLUDE) \ -) - -$(call gb_LinkTarget_add_defs,$(1),\ - $(filter-out -I% -isystem%,$(subst -isystem /,-isystem/,$(KDE4_CFLAGS))) \ -) - -$(call gb_LinkTarget_add_libs,$(1),\ - $(KDE4_LIBS) \ -) - -endef - -else # !ENABLE_KDE4 - -define gb_LinkTarget__use_kde4 - -endef - -endif # ENABLE_KDE4 - - ifeq ($(ENABLE_KDE5),TRUE) define gb_LinkTarget__use_kde5 diff --git a/bin/check-elf-dynamic-objects b/bin/check-elf-dynamic-objects index 7b92a61d15ce..c83649850331 100755 --- a/bin/check-elf-dynamic-objects +++ b/bin/check-elf-dynamic-objects @@ -96,7 +96,6 @@ gstreamer010whitelist="libgstpbutils-0.10.so.0 libgstinterfaces-0.10.so.0 libgst gstreamerwhitelist="libgstpbutils-1.0.so.0 libgstvideo-1.0.so.0 libgstbase-1.0.so.0 libgstreamer-1.0.so.0" gtk2whitelist="libgtk-x11-2.0.so.0 libgdk-x11-2.0.so.0 libpangocairo-1.0.so.0 libfribidi.so.0 libatk-1.0.so.0 libcairo.so.2 libgio-2.0.so.0 libpangoft2-1.0.so.0 libpango-1.0.so.0 libfontconfig.so.1 libfreetype.so.6 libgdk_pixbuf-2.0.so.0 libgobject-2.0.so.0 libglib-2.0.so.0 libgmodule-2.0.so.0 libgthread-2.0.so.0 libdbus-glib-1.so.2 libdbus-1.so.3" gtk3whitelist="libgtk-3.so.0 libgdk-3.so.0 libcairo-gobject.so.2 libpangocairo-1.0.so.0 libfribidi.so.0 libatk-1.0.so.0 libcairo.so.2 libgio-2.0.so.0 libpangoft2-1.0.so.0 libpango-1.0.so.0 libfontconfig.so.1 libfreetype.so.6 libgdk_pixbuf-2.0.so.0 libgobject-2.0.so.0 libglib-2.0.so.0 libgmodule-2.0.so.0 libgthread-2.0.so.0 libdbus-glib-1.so.2 libdbus-1.so.3" -kde4whitelist="libkio.so.5 libkfile.so.4 libkdeui.so.5 libkdecore.so.5 libQtNetwork.so.4 libQtGui.so.4 libQtCore.so.4 libglib-2.0.so.0" qt5whitelist="libQt5Core.so.5 libQt5Gui.so.5 libQt5Network.so.5 libQt5Widgets.so.5 libQt5X11Extras.so.5 libcairo.so.2 libglib-2.0.so.0" kf5whitelist="libKF5ConfigCore.so.5 libKF5CoreAddons.so.5 libKF5I18n.so.5 libKF5KIOCore.so.5 libKF5KIOFileWidgets.so.5 libKF5KIOWidgets.so.5 libKF5WindowSystem.so.5" avahiwhitelist="libdbus-glib-1.so.2 libdbus-1.so.3 libgobject-2.0.so.0 libgmodule-2.0.so.0 libgthread-2.0.so.0 libglib-2.0.so.0 libavahi-common.so.3 libavahi-client.so.3" @@ -126,9 +125,6 @@ local file="$1" */libavmediagst_0_10.so) whitelist="${whitelist} ${gtk2whitelist} ${gstreamer010whitelist}" ;; - */libvclplug_kde4lo.so|*/libkde4be1lo.so) - whitelist="${whitelist} ${x11whitelist} ${kde4whitelist}" - ;; */libvclplug_kde5lo.so|*/libkde5be1lo.so) if [ "$ENABLE_KDE5" = TRUE ]; then whitelist="${whitelist} ${qt5whitelist} ${kf5whitelist} libxcb.so.1" diff --git a/bin/distro-install-file-lists b/bin/distro-install-file-lists index 378f55ce746b..4cbe0be407ac 100755 --- a/bin/distro-install-file-lists +++ b/bin/distro-install-file-lists @@ -216,12 +216,6 @@ if test "z$OOO_VENDOR" != "zDebian" ; then cd $FILELISTSDIR - # create kde4 subpackage - test -f $DESTDIR/gid_Module_Optional_Kde && cp $DESTDIR/gid_Module_Optional_Kde kde4_list.txt || : - mv_file_between_flists kde4_list.txt common_list.txt $INSTALLDIR/program/libvclplug_kde4l..so - mv_file_between_flists kde4_list.txt common_list.txt $INSTALLDIR/program/fps_kde4lo.so - add_used_directories kde4_list.txt common_list.txt - # gnome subpackage test -f $DESTDIR/gid_Module_Optional_Gnome && cp $DESTDIR/gid_Module_Optional_Gnome gnome_list.txt || : mv_file_between_flists gnome_list.txt common_list.txt $INSTALLDIR/program/libevoab2.so diff --git a/config_host.mk.in b/config_host.mk.in index 51125374491d..a74114d0643d 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -145,7 +145,6 @@ export DISABLE_GUI=@DISABLE_GUI@ export ENABLE_HTMLHELP=@ENABLE_HTMLHELP@ export ENABLE_IOS_LIBREOFFICELIGHT_APP=@ENABLE_IOS_LIBREOFFICELIGHT_APP@ export ENABLE_JAVA=@ENABLE_JAVA@ -export ENABLE_KDE4=@ENABLE_KDE4@ export ENABLE_LPSOLVE=@ENABLE_LPSOLVE@ export ENABLE_LTO=@ENABLE_LTO@ export ENABLE_LWP=@ENABLE_LWP@ @@ -302,11 +301,6 @@ export JDK=@JDK@ export JFREEREPORT_JAR=@JFREEREPORT_JAR@ export JITC_PROCESSOR_TYPE=@JITC_PROCESSOR_TYPE@ export JVM_ONE_PATH_CHECK=@JVM_ONE_PATH_CHECK@ -export KDE4_CFLAGS=$(gb_SPACE)@KDE4_CFLAGS@ -export KDE4_LIBS=$(gb_SPACE)@KDE4_LIBS@ -export KDE4_GLIB_CFLAGS=$(gb_SPACE)@KDE4_GLIB_CFLAGS@ -export KDE4_GLIB_LIBS=$(gb_SPACE)@KDE4_GLIB_LIBS@ -export KDE4_HAVE_GLIB=@KDE4_HAVE_GLIB@ export KF5_CFLAGS=$(gb_SPACE)@KF5_CFLAGS@ export KF5_LIBS=$(gb_SPACE)@KF5_LIBS@ export KRB5_LIBS=@KRB5_LIBS@ diff --git a/config_host/config_kde4.h.in b/config_host/config_kde4.h.in deleted file mode 100644 index 50e85530be26..000000000000 --- a/config_host/config_kde4.h.in +++ /dev/null @@ -1,10 +0,0 @@ -/* -Settings for KDE4 integration. -*/ - -#ifndef CONFIG_KDE4_H -#define CONFIG_KDE4_H - -#define KDE4_HAVE_GLIB 0 - -#endif diff --git a/config_host/config_vclplug.h.in b/config_host/config_vclplug.h.in index be9c136245ee..5bd9b4b98fe4 100644 --- a/config_host/config_vclplug.h.in +++ b/config_host/config_vclplug.h.in @@ -8,7 +8,6 @@ Settings about which X11 desktops have support enabled. #define CONFIG_VCLPLUG_H #define ENABLE_GTK 0 -#define ENABLE_KDE4 0 #define ENABLE_KDE5 0 #define ENABLE_GTK3_KDE5 0 diff --git a/configure.ac b/configure.ac index e30d0cc938b6..915dbe3772b7 100644 --- a/configure.ac +++ b/configure.ac @@ -598,7 +598,6 @@ linux-gnu*|k*bsd*-gnu*) test_gtk=yes build_gstreamer_1_0=yes build_gstreamer_0_10=yes - test_kde4=yes test_kde5=yes test_gtk3_kde5=yes if test "$enable_fuzzers" != yes; then @@ -692,7 +691,6 @@ freebsd*) test_gtk=yes build_gstreamer_1_0=yes build_gstreamer_0_10=yes - test_kde4=yes test_kde5=yes test_gtk3_kde5=yes test_freetype=yes @@ -722,7 +720,6 @@ freebsd*) test_gtk=yes build_gstreamer_1_0=yes build_gstreamer_0_10=yes - test_kde4=yes test_kde5=yes test_gtk3_kde5=yes test_freetype=yes @@ -749,7 +746,6 @@ dragonfly*) test_gtk=yes build_gstreamer_1_0=yes build_gstreamer_0_10=yes - test_kde4=yes test_kde5=yes test_gtk3_kde5=yes test_freetype=yes @@ -774,7 +770,6 @@ linux-android*) test_fontconfig=no test_freetype=no test_gtk=no - test_kde4=no test_kde5=no test_gtk3_kde5=no test_randr=no @@ -1255,12 +1250,6 @@ libo_FUZZ_ARG_ENABLE(gio, [Determines whether to use the GIO support.]), ,test "${enable_gio+set}" = set || enable_gio=yes) -AC_ARG_ENABLE(kde4, - AS_HELP_STRING([--enable-kde4], - [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and - KDE4 are available.]), -,) - AC_ARG_ENABLE(qt5, AS_HELP_STRING([--enable-qt5], [Determines whether to use Qt5 vclplug on platforms where Qt5 is @@ -4701,7 +4690,6 @@ if test "$USING_X11" != TRUE; then test_gtk=no build_gstreamer_1_0=no build_gstreamer_0_10=no - test_kde4=no test_kde5=no test_qt5=no test_gtk3_kde5=no @@ -10123,14 +10111,6 @@ if test "x$enable_gtk" = "xyes"; then fi AC_SUBST(ENABLE_GTK) -ENABLE_KDE4="" -if test "x$enable_kde4" = "xyes"; then - ENABLE_KDE4="TRUE" - AC_DEFINE(ENABLE_KDE4) - R="$R kde4" -fi -AC_SUBST(ENABLE_KDE4) - ENABLE_QT5="" if test "x$enable_qt5" = "xyes"; then ENABLE_QT5="TRUE" @@ -10898,307 +10878,6 @@ AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT) AC_SUBST(SYSTEM_RHINO) AC_SUBST(RHINO_JAR) -# This is only used in KDE3/KDE4 checks to determine if /usr/lib64 -# paths should be added to library search path. So lets put all 64-bit -# platforms there. -supports_multilib= -case "$host_cpu" in -x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el) - if test "$SAL_TYPES_SIZEOFLONG" = "8"; then - supports_multilib="yes" - fi - ;; -*) - ;; -esac - -dnl =================================================================== -dnl KDE4 Integration -dnl =================================================================== - -KDE4_CFLAGS="" -KDE4_LIBS="" -QMAKE4="qmake" -MOC4="moc" -KDE4_GLIB_CFLAGS="" -KDE4_GLIB_LIBS="" -KDE4_HAVE_GLIB="" -if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then - qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes" - qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries" - - kde4_incdirs="/usr/include /usr/include/kde4 $x_includes" - kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries" - - if test -n "$supports_multilib"; then - qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64" - kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel" - fi - - if test -n "$QTDIR"; then - qt4_incdirs="$QTDIR/include $qt4_incdirs" - if test -z "$supports_multilib"; then - qt4_libdirs="$QTDIR/lib $qt4_libdirs" - else - qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs" - fi - fi - if test -n "$QT4DIR"; then - qt4_incdirs="$QT4DIR/include $qt4_incdirs" - if test -z "$supports_multilib"; then - qt4_libdirs="$QT4DIR/lib $qt4_libdirs" - else - qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs" - fi - fi - - if test -n "$KDEDIR"; then - kde4_incdirs="$KDEDIR/include $kde4_incdirs" - if test -z "$supports_multilib"; then - kde4_libdirs="$KDEDIR/lib $kde4_libdirs" - else - kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs" - fi - fi - if test -n "$KDE4DIR"; then - kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs" - if test -z "$supports_multilib"; then - kde4_libdirs="$KDE4DIR/lib $kde4_libdirs" - else - kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs" - fi - fi - - qt4_test_include="Qt/qobject.h" - qt4_test_library="libQtNetwork.so" - kde4_test_include="kwindowsystem.h" - kde4_test_library="libsolid.so" - - AC_MSG_CHECKING([for Qt4 headers]) - qt4_header_dir="no" - for inc_dir in $qt4_incdirs; do - if test -r "$inc_dir/$qt4_test_include"; then - qt4_header_dir="$inc_dir" - break - fi - done - - AC_MSG_RESULT([$qt4_header_dir]) - if test "x$qt4_header_dir" = "xno"; then - AC_MSG_ERROR([Qt4 headers not found. Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".]) - fi - - dnl Check for qmake - AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] ) - if test "$QMAKE4" = "no"; then - AC_MSG_ERROR([Qmake not found. Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".]) - else - qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`" - if test -z "$qmake4_test_ver"; then - AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".]) - fi - fi - - qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs" - AC_MSG_CHECKING([for Qt4 libraries]) - qt4_lib_dir="no" - for lib_dir in $qt4_libdirs; do - if test -r "$lib_dir/$qt4_test_library"; then - qt4_lib_dir="$lib_dir" - PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH - break - fi - done - - AC_MSG_RESULT([$qt4_lib_dir]) - - if test "x$qt4_lib_dir" = "xno"; then - AC_MSG_ERROR([Qt4 libraries not found. Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".]) - fi - - dnl Check for Meta Object Compiler - - AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] ) - MOC4="$MOCQT4" - if test "$MOC4" = "no"; then - AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] ) - if test "$MOC4" = "no"; then - AC_MSG_ERROR([Qt Meta Object Compiler not found. Please specify -the root of your Qt installation by exporting QT4DIR before running "configure".]) - fi - fi - - dnl Check for KDE4 headers - AC_MSG_CHECKING([for KDE4 headers]) - kde4_incdir="no" - for kde4_check in $kde4_incdirs; do - if test -r "$kde4_check/$kde4_test_include"; then - kde4_incdir="$kde4_check" - break - fi - done - AC_MSG_RESULT([$kde4_incdir]) - if test "x$kde4_incdir" = "xno"; then - AC_MSG_ERROR([KDE4 headers not found. Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".]) - fi - if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi - - dnl Check for KDE4 libraries - AC_MSG_CHECKING([for KDE4 libraries]) - kde4_libdir="no" - for kde4_check in $kde4_libdirs; do - if test -r "$kde4_check/$kde4_test_library"; then - kde4_libdir="$kde4_check" - break - fi - done - - AC_MSG_RESULT([$kde4_libdir]) - if test "x$kde4_libdir" = "xno"; then - AC_MSG_ERROR([KDE4 libraries not found. Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".]) - fi - - PKG_CHECK_MODULES([QT4],[QtNetwork QtGui]) - if ! test -z "$kde4_incdir"; then - KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT" - else - KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT" - fi - - KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS" - KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g") - FilterLibs "$KDE4_LIBS" - KDE4_LIBS="$filteredlibs" - - AC_LANG_PUSH([C++]) - save_CXXFLAGS=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS" - AC_MSG_CHECKING([whether KDE is >= 4.2]) - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include - -int main(int argc, char **argv) { - if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0; - else return 1; -} -]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])]) - CXXFLAGS=$save_CXXFLAGS - AC_LANG_POP([C++]) - - # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled. - # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful. - PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4], - [ - KDE4_HAVE_GLIB=TRUE - AC_DEFINE(KDE4_HAVE_GLIB,1) - KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g") - FilterLibs "${KDE4_GLIB_LIBS}" - KDE4_GLIB_LIBS="${filteredlibs}" - - qt4_fix_warning= - - AC_LANG_PUSH([C++]) - # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData' - # 0x60d00000bb20: note: object is of type 'QObjectPrivate' - # 02 00 80 3a 90 8a 4e d2 3a 00 00 00 f0 b4 b9 a7 ff 7f 00 00 00 00 00 00 00 00 00 00 20 d8 4e d2 - # ^~~~~~~~~~~~~~~~~~~~~~~ - # vptr for 'QObjectPrivate' - # so temporarily ignore here whichever way would be used to make such errors fatal - # (-fno-sanitize-recover=... or UBSAN_OPTIONS halt_on_error=1): - save_CXX=$CXX - CXX=$(printf %s "$CXX" \ - | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//') - save_UBSAN_OPTIONS=$UBSAN_OPTIONS - UBSAN_OPTIONS=$UBSAN_OPTIONS:halt_on_error=0 - save_CXXFLAGS=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS" - save_LIBS=$LIBS - LIBS="$LIBS $KDE4_LIBS" - AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers]) - - # Prepare meta object data - TSTBASE="tst_exclude_socket_notifiers" - TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}" - ln -fs "${TSTMOC}.hxx" - $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc" - - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include -#include "tst_exclude_socket_notifiers.moc" - -int main(int argc, char *argv[]) -{ - QCoreApplication app(argc, argv); - exit(tst_processEventsExcludeSocket()); - return 0; -} - ]])],[ - AC_MSG_RESULT([yes]) - ],[ - AC_MSG_RESULT([no]) - AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime]) - if test -z "$qt4_fix_warning"; then - add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed" - fi - qt4_fix_warning=1 - add_warning " https://bugreports.qt.io/browse/QTBUG-37380 (needed)" - ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])]) - - # Remove meta object data - rm -f "${TSTBASE}."* - - AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events]) - - # Prepare meta object data - TSTBASE="tst_exclude_posted_events" - TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}" - ln -fs "${TSTMOC}.hxx" - $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc" - - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include -#include "tst_exclude_posted_events.moc" - -int main(int argc, char *argv[]) -{ - QCoreApplication app(argc, argv); - exit(tst_excludePostedEvents()); - return 0; -} - ]])],[ - AC_MSG_RESULT([yes]) - ],[ - AC_MSG_RESULT([no]) - AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime]) - if test -z "$qt4_fix_warning"; then - add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed" - fi - qt4_fix_warning=1 - add_warning " https://bugreports.qt.io/browse/QTBUG-34614 (needed)" - ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])]) - - # Remove meta object data - rm -f "${TSTBASE}."* - - if test -n "$qt4_fix_warning"; then - add_warning " https://bugreports.qt.io/browse/QTBUG-38585 (recommended)" - fi - - LIBS=$save_LIBS - CXXFLAGS=$save_CXXFLAGS - UBSAN_OPTIONS=$save_UBSAN_OPTIONS - CXX=$save_CXX - AC_LANG_POP([C++]) - ], - AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]])) -fi -AC_SUBST(KDE4_CFLAGS) -AC_SUBST(KDE4_LIBS) -AC_SUBST(MOC4) -AC_SUBST(KDE4_GLIB_CFLAGS) -AC_SUBST(KDE4_GLIB_LIBS) -AC_SUBST(KDE4_HAVE_GLIB) - dnl =================================================================== dnl QT5 Integration dnl =================================================================== @@ -12873,7 +12552,6 @@ AC_CONFIG_HEADERS([config_host/config_liblangtag.h]) AC_CONFIG_HEADERS([config_host/config_libnumbertext.h]) AC_CONFIG_HEADERS([config_host/config_locales.h]) AC_CONFIG_HEADERS([config_host/config_mpl.h]) -AC_CONFIG_HEADERS([config_host/config_kde4.h]) AC_CONFIG_HEADERS([config_host/config_qt5.h]) AC_CONFIG_HEADERS([config_host/config_kde5.h]) AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h]) diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx index d38e636d2fa9..c62df6631a6d 100644 --- a/cppuhelper/source/servicemanager.cxx +++ b/cppuhelper/source/servicemanager.cxx @@ -1876,14 +1876,6 @@ void cppuhelper::ServiceManager::preloadImplementations() { if (iterator->second->info->loader == "com.sun.star.loader.SharedLibrary" && iterator->second->status != Data::Implementation::STATUS_LOADED) { - // Blacklist some components that are known to fail - if (iterator->second->info->name == "com.sun.star.comp.configuration.backend.KDE4Backend") - { - std::cerr << ":skipping"; - std::cerr.flush(); - continue; - } - // load component library osl::Module aModule(aUri, SAL_LOADMODULE_NOW | SAL_LOADMODULE_GLOBAL); diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index 4db46539816c..8ede124d16be 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -21,7 +21,6 @@ $(eval $(call gb_Library_set_precompiled_header,cui,$(SRCDIR)/cui/inc/pch/precom $(eval $(call gb_Library_add_defs,cui,\ $(if $(filter TRUE,$(ENABLE_GTK)),-DENABLE_GTK) \ - $(if $(filter TRUE,$(ENABLE_KDE4)),-DENABLE_KDE4) \ )) $(eval $(call gb_Library_use_custom_headers,cui,\ diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index bc2510fb8e7a..9fa7ce06d79b 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -206,10 +206,10 @@ OUString impl_SystemFileOpenServiceName() { const OUString &rDesktopEnvironment = Application::GetDesktopEnvironment(); - if ( rDesktopEnvironment.equalsIgnoreAsciiCase("kde4") ) + if ( rDesktopEnvironment.equalsIgnoreAsciiCase("kde5") ) { - #if ENABLE_KDE4 - return OUString("com.sun.star.ui.dialogs.KDE4FilePicker" ); + #if ENABLE_KDE5 + return OUString("com.sun.star.ui.dialogs.KDE5FilePicker" ); #else return OUString(); #endif diff --git a/distro-configs/Jenkins/LibreOfficeLinuxUpdater.conf b/distro-configs/Jenkins/LibreOfficeLinuxUpdater.conf index e5b5ebdc9110..4ddcc344a796 100644 --- a/distro-configs/Jenkins/LibreOfficeLinuxUpdater.conf +++ b/distro-configs/Jenkins/LibreOfficeLinuxUpdater.conf @@ -16,7 +16,7 @@ --with-external-dict-dir=/usr/share/hunspell --enable-dbus --enable-extension-integration ---enable-kde4 +--enable-kde5 # --enable-gstreamer-0-10 --enable-gstreamer-1-0 --enable-evolution2 diff --git a/distro-configs/Jenkins/Linux_dev_master.conf b/distro-configs/Jenkins/Linux_dev_master.conf index 6b3c7a7b0cc0..505e03568ad0 100644 --- a/distro-configs/Jenkins/Linux_dev_master.conf +++ b/distro-configs/Jenkins/Linux_dev_master.conf @@ -1,4 +1,4 @@ --enable-dbgutil ---enable-kde4 +--enable-kde5 CC=/opt/rh/devtoolset-7/root/usr/bin/gcc CXX=/opt/rh/devtoolset-7/root/usr/bin/g++ diff --git a/distro-configs/Jenkins/Linux_rel_master.conf b/distro-configs/Jenkins/Linux_rel_master.conf index ca2119d9e7a7..77c7dc6b64b4 100644 --- a/distro-configs/Jenkins/Linux_rel_master.conf +++ b/distro-configs/Jenkins/Linux_rel_master.conf @@ -1,4 +1,4 @@ --disable-werror ---enable-kde4 +--enable-kde5 CC=/opt/rh/devtoolset-7/root/usr/bin/gcc CXX=/opt/rh/devtoolset-7/root/usr/bin/g++ diff --git a/distro-configs/LibreOfficeCoverity.conf b/distro-configs/LibreOfficeCoverity.conf index e387254a6405..34b9593a6984 100644 --- a/distro-configs/LibreOfficeCoverity.conf +++ b/distro-configs/LibreOfficeCoverity.conf @@ -14,7 +14,7 @@ --enable-dbus --enable-extension-integration --enable-gtk3 ---enable-kde4 +--enable-kde5 --enable-evolution2 --enable-scripting-beanshell --enable-scripting-javascript diff --git a/distro-configs/LibreOfficeLinux.conf b/distro-configs/LibreOfficeLinux.conf index e6e887af646d..2be88ea32d19 100644 --- a/distro-configs/LibreOfficeLinux.conf +++ b/distro-configs/LibreOfficeLinux.conf @@ -20,7 +20,7 @@ --enable-dbus --enable-extension-integration --enable-odk ---enable-kde4 +--disable-kde5 --disable-gtk3 --enable-gstreamer-0-10 --enable-gstreamer-1-0 diff --git a/distro-configs/LibreOfficeOpenBSD.conf b/distro-configs/LibreOfficeOpenBSD.conf index fb0e3551c0d4..bc3905df10e3 100644 --- a/distro-configs/LibreOfficeOpenBSD.conf +++ b/distro-configs/LibreOfficeOpenBSD.conf @@ -1,7 +1,6 @@ --disable-dbus --disable-epm ---disable-kde ---disable-kde4 +--disable-kde5 --disable-nss-module --disable-odk --enable-gstreamer-0-10 diff --git a/distro-configs/LibreOfficeiOS.conf b/distro-configs/LibreOfficeiOS.conf index 92bc968a9f76..411ba8d69798 100644 --- a/distro-configs/LibreOfficeiOS.conf +++ b/distro-configs/LibreOfficeiOS.conf @@ -19,7 +19,7 @@ --disable-database-connectivity --disable-dconf --disable-extensions ---disable-kde4 +--disable-kde5 --disable-odk --disable-openssl --disable-pdfium diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox index aa9c3e3ccd09..66ca425e9fea 100644 --- a/include/sal/log-areas.dox +++ b/include/sal/log-areas.dox @@ -474,7 +474,6 @@ certain functionality. @li @c vcl.headless - bitmap-based backend @li @c vcl.helper @li @c vcl.icontest -@li @c vcl.kde4 - KDE4 @li @c vcl.kde5 - KDE5 @li @c vcl.layout - Widget layout @li @c vcl.lazydelete diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk index e189b433e4b0..0e175de547cc 100644 --- a/postprocess/Rdb_services.mk +++ b/postprocess/Rdb_services.mk @@ -207,9 +207,6 @@ $(eval $(call gb_Rdb_add_components,services,\ $(if $(ENABLE_VLC), \ avmedia/source/vlc/avmediavlc \ ) \ - $(if $(ENABLE_KDE4), \ - shell/source/backends/kde4be/kde4be1 \ - ) \ $(if $(ENABLE_KDE5), \ shell/source/backends/kde5be/kde5be1 \ ) \ diff --git a/scp2/InstallScript_setup_osl.mk b/scp2/InstallScript_setup_osl.mk index a37a4552c139..6c2496390883 100644 --- a/scp2/InstallScript_setup_osl.mk +++ b/scp2/InstallScript_setup_osl.mk @@ -35,7 +35,7 @@ $(eval $(call gb_InstallScript_use_modules,setup_osl,\ $(if $(filter TRUE,$(ENABLE_EVOAB2) $(ENABLE_GIO) $(ENABLE_GTK) $(ENABLE_GTK3)),\ scp2/gnome \ ) \ - $(if $(filter TRUE,$(ENABLE_KDE4) $(ENABLE_QT5) $(ENABLE_KDE5) $(ENABLE_GTK3_KDE5)),\ + $(if $(filter TRUE,$(ENABLE_QT5) $(ENABLE_KDE5) $(ENABLE_GTK3_KDE5)),\ scp2/kde \ ) \ $(if $(filter TRUE,$(ENABLE_ONLINE_UPDATE)),\ diff --git a/scp2/Module_scp2.mk b/scp2/Module_scp2.mk index c414e09045cb..55ea333df005 100644 --- a/scp2/Module_scp2.mk +++ b/scp2/Module_scp2.mk @@ -39,7 +39,7 @@ $(eval $(call gb_Module_add_targets,scp2,\ $(if $(filter TRUE,$(ENABLE_EVOAB2) $(ENABLE_GIO) $(ENABLE_GTK) $(ENABLE_GTK3)),\ InstallModule_gnome \ ) \ - $(if $(filter TRUE,$(ENABLE_KDE4) $(ENABLE_QT5) $(ENABLE_KDE5) $(ENABLE_GTK3_KDE5)),\ + $(if $(filter TRUE,$(ENABLE_QT5) $(ENABLE_KDE5) $(ENABLE_GTK3_KDE5)),\ InstallModule_kde \ ) \ )) diff --git a/shell/Library_kde4be.mk b/shell/Library_kde4be.mk deleted file mode 100644 index 45ca84c45e34..000000000000 --- a/shell/Library_kde4be.mk +++ /dev/null @@ -1,32 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# 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/. -# - -$(eval $(call gb_Library_Library,kde4be1)) - -$(eval $(call gb_Library_use_sdk_api,kde4be1)) - -$(eval $(call gb_Library_use_externals,kde4be1,\ - boost_headers \ - kde4 \ -)) - -$(eval $(call gb_Library_use_libraries,kde4be1,\ - cppu \ - cppuhelper \ - sal \ -)) - -$(eval $(call gb_Library_set_componentfile,kde4be1,shell/source/backends/kde4be/kde4be1)) - -$(eval $(call gb_Library_add_exception_objects,kde4be1,\ - shell/source/backends/kde4be/kde4access \ - shell/source/backends/kde4be/kde4backend \ -)) - -# vim: set shiftwidth=4 tabstop=4 noexpandtab: diff --git a/shell/Module_shell.mk b/shell/Module_shell.mk index 6d54617f0268..48e0aaecdfb3 100644 --- a/shell/Module_shell.mk +++ b/shell/Module_shell.mk @@ -30,12 +30,6 @@ $(eval $(call gb_Module_add_targets,shell,\ endif endif -ifeq ($(ENABLE_KDE4),TRUE) -$(eval $(call gb_Module_add_targets,shell,\ - Library_kde4be \ -)) -endif - ifeq ($(ENABLE_KDE5),TRUE) $(eval $(call gb_Module_add_targets,shell,\ Library_kde5be \ diff --git a/shell/source/backends/desktopbe/desktopbackend.cxx b/shell/source/backends/desktopbe/desktopbackend.cxx index 8cfaefc9f9c9..0860bcd421a1 100644 --- a/shell/source/backends/desktopbe/desktopbackend.cxx +++ b/shell/source/backends/desktopbe/desktopbackend.cxx @@ -296,20 +296,12 @@ css::uno::Reference< css::uno::XInterface > createInstance( current->getValueByName("system.desktop-environment") >>= desktop; } - OUString sTK = Application::GetToolkitName(); - // Fall back to the default if the specific backend is not available: css::uno::Reference< css::uno::XInterface > backend; - if ( desktop == "KDE4" ) { - if (!(sTK.startsWith("qt5") || sTK.startsWith("kde5"))) - backend = createBackend( - context, - "com.sun.star.configuration.backend.KDE4Backend"); - } else if ( desktop == "KDE5" ) { - if (!(sTK.startsWith("kde4"))) - backend = createBackend( - context, - "com.sun.star.configuration.backend.KDE5Backend"); + if ( desktop == "KDE5" ) { + backend = createBackend( + context, + "com.sun.star.configuration.backend.KDE5Backend"); } return backend.is() ? backend : static_cast< cppu::OWeakObject * >(new Default); diff --git a/shell/source/backends/kde4be/kde4access.cxx b/shell/source/backends/kde4be/kde4access.cxx deleted file mode 100644 index fc27054cd895..000000000000 --- a/shell/source/backends/kde4be/kde4access.cxx +++ /dev/null @@ -1,300 +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 - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "kde4access.hxx" - -#define SPACE ' ' -#define COMMA ',' -#define SEMI_COLON ';' - -namespace kde4access { - -namespace { - -namespace uno = css::uno ; - -} - -css::beans::Optional< css::uno::Any > getValue(OUString const & id) { - if ( id == "ExternalMailer" ) { - KEMailSettings aEmailSettings; - QString aClientProgram; - OUString sClientProgram; - - aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram ); - if ( aClientProgram.isEmpty() ) - aClientProgram = "kmail"; - else - aClientProgram = aClientProgram.section(SPACE, 0, 0); - sClientProgram = reinterpret_cast(aClientProgram.utf16()); - return css::beans::Optional< css::uno::Any >( - true, uno::makeAny( sClientProgram ) ); - } else if (id == "SourceViewFontHeight") - { - QFont aFixedFont; - short nFontHeight; - - aFixedFont = KGlobalSettings::fixedFont(); - nFontHeight = aFixedFont.pointSize(); - return css::beans::Optional< css::uno::Any >( - true, uno::makeAny( nFontHeight ) ); - } else if (id == "SourceViewFontName") - { - QFont aFixedFont; - QString aFontName; - OUString sFontName; - - aFixedFont = KGlobalSettings::fixedFont(); - aFontName = aFixedFont.family(); - sFontName = reinterpret_cast(aFontName.utf16()); - return css::beans::Optional< css::uno::Any >( - true, uno::makeAny( sFontName ) ); - } else if (id == "EnableATToolSupport") - { - /* does not make much sense without an accessibility bridge */ - return css::beans::Optional< css::uno::Any >( - true, uno::makeAny( OUString::boolean( false ) ) ); - } else if (id == "WorkPathVariable") - { - QString aDocumentsDir( KGlobalSettings::documentPath() ); - OUString sDocumentsDir; - OUString sDocumentsURL; - if ( aDocumentsDir.endsWith(QChar('/')) ) - aDocumentsDir.truncate ( aDocumentsDir.length() - 1 ); - sDocumentsDir = reinterpret_cast(aDocumentsDir.utf16()); - osl_getFileURLFromSystemPath( sDocumentsDir.pData, &sDocumentsURL.pData ); - return css::beans::Optional< css::uno::Any >( - true, uno::makeAny( sDocumentsURL ) ); - } else if (id == "ooInetFTPProxyName") - { - QString aFTPProxy; - switch ( KProtocolManager::proxyType() ) - { - case KProtocolManager::ManualProxy: // Proxies are manually configured - aFTPProxy = KProtocolManager::proxyFor( "FTP" ); - break; - case KProtocolManager::PACProxy: // A proxy configuration URL has been given - case KProtocolManager::WPADProxy: // A proxy should be automatically discovered - case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables -// In such cases, the proxy address is not stored in KDE, but determined dynamically. -// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... -// The best we can do here is to ask the current value for a given address. - aFTPProxy = KProtocolManager::proxyForUrl( KUrl("ftp://ftp.libreoffice.org") ); - break; - default: // No proxy is used - break; - } - if ( !aFTPProxy.isEmpty() ) - { - KUrl aProxy(aFTPProxy); - OUString sProxy = reinterpret_cast(aProxy.host().utf16()); - return css::beans::Optional< css::uno::Any >( - true, uno::makeAny( sProxy ) ); - } - } else if (id == "ooInetFTPProxyPort") - { - QString aFTPProxy; - switch ( KProtocolManager::proxyType() ) - { - case KProtocolManager::ManualProxy: // Proxies are manually configured - aFTPProxy = KProtocolManager::proxyFor( "FTP" ); - break; - case KProtocolManager::PACProxy: // A proxy configuration URL has been given - case KProtocolManager::WPADProxy: // A proxy should be automatically discovered - case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables -// In such cases, the proxy address is not stored in KDE, but determined dynamically. -// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... -// The best we can do here is to ask the current value for a given address. - aFTPProxy = KProtocolManager::proxyForUrl( KUrl("ftp://ftp.libreoffice.org") ); - break; - default: // No proxy is used - break; - } - if ( !aFTPProxy.isEmpty() ) - { - KUrl aProxy(aFTPProxy); - sal_Int32 nPort = aProxy.port(); - return css::beans::Optional< css::uno::Any >( - true, uno::makeAny( nPort ) ); - } - } else if (id == "ooInetHTTPProxyName") - { - QString aHTTPProxy; - switch ( KProtocolManager::proxyType() ) - { - case KProtocolManager::ManualProxy: // Proxies are manually configured - aHTTPProxy = KProtocolManager::proxyFor( "HTTP" ); - break; - case KProtocolManager::PACProxy: // A proxy configuration URL has been given - case KProtocolManager::WPADProxy: // A proxy should be automatically discovered - case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables -// In such cases, the proxy address is not stored in KDE, but determined dynamically. -// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... -// The best we can do here is to ask the current value for a given address. - aHTTPProxy = KProtocolManager::proxyForUrl( KUrl("http://http.libreoffice.org") ); - break; - default: // No proxy is used - break; - } - if ( !aHTTPProxy.isEmpty() ) - { - KUrl aProxy(aHTTPProxy); - OUString sProxy = reinterpret_cast(aProxy.host().utf16()); - return css::beans::Optional< css::uno::Any >( - true, uno::makeAny( sProxy ) ); - } - } else if (id == "ooInetHTTPProxyPort") - { - QString aHTTPProxy; - switch ( KProtocolManager::proxyType() ) - { - case KProtocolManager::ManualProxy: // Proxies are manually configured - aHTTPProxy = KProtocolManager::proxyFor( "HTTP" ); - break; - case KProtocolManager::PACProxy: // A proxy configuration URL has been given - case KProtocolManager::WPADProxy: // A proxy should be automatically discovered - case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables -// In such cases, the proxy address is not stored in KDE, but determined dynamically. -// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... -// The best we can do here is to ask the current value for a given address. - aHTTPProxy = KProtocolManager::proxyForUrl( KUrl("http://http.libreoffice.org") ); - break; - default: // No proxy is used - break; - } - if ( !aHTTPProxy.isEmpty() ) - { - KUrl aProxy(aHTTPProxy); - sal_Int32 nPort = aProxy.port(); - return css::beans::Optional< css::uno::Any >( - true, uno::makeAny( nPort ) ); - } - } else if (id == "ooInetHTTPSProxyName") - { - QString aHTTPSProxy; - switch ( KProtocolManager::proxyType() ) - { - case KProtocolManager::ManualProxy: // Proxies are manually configured - aHTTPSProxy = KProtocolManager::proxyFor( "HTTPS" ); - break; - case KProtocolManager::PACProxy: // A proxy configuration URL has been given - case KProtocolManager::WPADProxy: // A proxy should be automatically discovered - case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables -// In such cases, the proxy address is not stored in KDE, but determined dynamically. -// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... -// The best we can do here is to ask the current value for a given address. - aHTTPSProxy = KProtocolManager::proxyForUrl( KUrl("https://https.libreoffice.org") ); - break; - default: // No proxy is used - break; - } - if ( !aHTTPSProxy.isEmpty() ) - { - KUrl aProxy(aHTTPSProxy); - OUString sProxy = reinterpret_cast(aProxy.host().utf16()); - return css::beans::Optional< css::uno::Any >( - true, uno::makeAny( sProxy ) ); - } - } else if (id == "ooInetHTTPSProxyPort") - { - QString aHTTPSProxy; - switch ( KProtocolManager::proxyType() ) - { - case KProtocolManager::ManualProxy: // Proxies are manually configured - aHTTPSProxy = KProtocolManager::proxyFor( "HTTPS" ); - break; - case KProtocolManager::PACProxy: // A proxy configuration URL has been given - case KProtocolManager::WPADProxy: // A proxy should be automatically discovered - case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables -// In such cases, the proxy address is not stored in KDE, but determined dynamically. -// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... -// The best we can do here is to ask the current value for a given address. - aHTTPSProxy = KProtocolManager::proxyForUrl( KUrl("https://https.libreoffice.org") ); - break; - default: // No proxy is used - break; - } - if ( !aHTTPSProxy.isEmpty() ) - { - KUrl aProxy(aHTTPSProxy); - sal_Int32 nPort = aProxy.port(); - return css::beans::Optional< css::uno::Any >( - true, uno::makeAny( nPort ) ); - } - } else if ( id == "ooInetNoProxy" ) { - QString aNoProxyFor; - switch ( KProtocolManager::proxyType() ) - { - case KProtocolManager::ManualProxy: // Proxies are manually configured - case KProtocolManager::PACProxy: // A proxy configuration URL has been given - case KProtocolManager::WPADProxy: // A proxy should be automatically discovered - case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables - aNoProxyFor = KProtocolManager::noProxyFor(); - break; - default: // No proxy is used - break; - } - if ( !aNoProxyFor.isEmpty() ) - { - OUString sNoProxyFor; - - aNoProxyFor = aNoProxyFor.replace( COMMA, SEMI_COLON ); - sNoProxyFor = reinterpret_cast(aNoProxyFor.utf16()); - return css::beans::Optional< css::uno::Any >( - true, uno::makeAny( sNoProxyFor ) ); - } - } else if ( id == "ooInetProxyType" ) { - int nProxyType; - switch ( KProtocolManager::proxyType() ) - { - case KProtocolManager::ManualProxy: // Proxies are manually configured - case KProtocolManager::PACProxy: // A proxy configuration URL has been given - case KProtocolManager::WPADProxy: // A proxy should be automatically discovered - case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables - nProxyType = 1; - break; - default: // No proxy is used - nProxyType = 0; - } - return css::beans::Optional< css::uno::Any >( - true, uno::makeAny( static_cast(nProxyType) ) ); - } else { - OSL_ASSERT(false); // this cannot happen - } - return css::beans::Optional< css::uno::Any >(); -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/backends/kde4be/kde4access.hxx b/shell/source/backends/kde4be/kde4access.hxx deleted file mode 100644 index f9516c050ac0..000000000000 --- a/shell/source/backends/kde4be/kde4access.hxx +++ /dev/null @@ -1,39 +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_SHELL_SOURCE_BACKENDS_KDE4BE_KDE4ACCESS_HXX -#define INCLUDED_SHELL_SOURCE_BACKENDS_KDE4BE_KDE4ACCESS_HXX - -#include - -#include - -namespace com { namespace sun { namespace star { namespace uno { - class Any; -} } } } - -namespace kde4access { - -css::beans::Optional< css::uno::Any > getValue(OUString const & id); - -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/backends/kde4be/kde4backend.cxx b/shell/source/backends/kde4be/kde4backend.cxx deleted file mode 100644 index 800465002c28..000000000000 --- a/shell/source/backends/kde4be/kde4backend.cxx +++ /dev/null @@ -1,180 +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 - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "kde4access.hxx" - -namespace { - -OUString getServiceImplementationName() { - return OUString( - "com.sun.star.comp.configuration.backend.KDE4Backend"); -} - -css::uno::Sequence< OUString > getServiceSupportedServiceNames() { - OUString name( - "com.sun.star.configuration.backend.KDE4Backend"); - return css::uno::Sequence< OUString >(&name, 1); -} - -class Service: - public cppu::WeakImplHelper< - css::lang::XServiceInfo, css::beans::XPropertySet > -{ -public: - Service(); - Service(const Service&) = delete; - Service& operator=(const Service&) = delete; - -private: - virtual ~Service() override {} - - virtual OUString SAL_CALL getImplementationName() override - { return getServiceImplementationName(); } - - virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override - { return ServiceName == getSupportedServiceNames()[0]; } - - virtual css::uno::Sequence< OUString > SAL_CALL - getSupportedServiceNames() override - { return getServiceSupportedServiceNames(); } - - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL - getPropertySetInfo() override - { return css::uno::Reference< css::beans::XPropertySetInfo >(); } - - virtual void SAL_CALL setPropertyValue( - OUString const &, css::uno::Any const &) override; - - virtual css::uno::Any SAL_CALL getPropertyValue( - OUString const & PropertyName) override; - - virtual void SAL_CALL addPropertyChangeListener( - OUString const &, - css::uno::Reference< css::beans::XPropertyChangeListener > const &) override - {} - - virtual void SAL_CALL removePropertyChangeListener( - OUString const &, - css::uno::Reference< css::beans::XPropertyChangeListener > const &) override - {} - - virtual void SAL_CALL addVetoableChangeListener( - OUString const &, - css::uno::Reference< css::beans::XVetoableChangeListener > const &) override - {} - - virtual void SAL_CALL removeVetoableChangeListener( - OUString const &, - css::uno::Reference< css::beans::XVetoableChangeListener > const &) override - {} - - bool enabled_; -}; - -Service::Service(): enabled_(false) { - css::uno::Reference< css::uno::XCurrentContext > context( - css::uno::getCurrentContext()); - if (context.is()) { - OUString desktop; - context->getValueByName("system.desktop-environment") >>= desktop; - enabled_ = desktop == "KDE4" && KApplication::kApplication() != nullptr; - } -} - -void Service::setPropertyValue(OUString const &, css::uno::Any const &) -{ - throw css::lang::IllegalArgumentException( - "setPropertyValue not supported", - static_cast< cppu::OWeakObject * >(this), -1); -} - -css::uno::Any Service::getPropertyValue(OUString const & PropertyName) -{ - if (PropertyName == "EnableATToolSupport" || PropertyName == "ExternalMailer" || PropertyName == "SourceViewFontHeight" - || PropertyName == "SourceViewFontName" || PropertyName == "WorkPathVariable" || PropertyName == "ooInetFTPProxyName" - || PropertyName == "ooInetFTPProxyPort" || PropertyName == "ooInetHTTPProxyName" || PropertyName == "ooInetHTTPProxyPort" - || PropertyName == "ooInetHTTPSProxyName" || PropertyName == "ooInetHTTPSProxyPort" || PropertyName == "ooInetNoProxy" - || PropertyName == "ooInetProxyType" || PropertyName == "TemplatePathVariable" ) - { - return css::uno::makeAny( - enabled_ - ? kde4access::getValue(PropertyName) - : css::beans::Optional< css::uno::Any >()); - } else if (PropertyName == "givenname" || PropertyName == "sn") { - return css::uno::makeAny(css::beans::Optional< css::uno::Any >()); - //TODO: obtain values from KDE? - } - throw css::beans::UnknownPropertyException( - PropertyName, static_cast< cppu::OWeakObject * >(this)); -} - -css::uno::Reference< css::uno::XInterface > createInstance( - css::uno::Reference< css::uno::XComponentContext > const &) -{ - return static_cast< cppu::OWeakObject * >(new Service); -} - -static cppu::ImplementationEntry const services[] = { - { &createInstance, &getServiceImplementationName, - &getServiceSupportedServiceNames, &cppu::createSingleComponentFactory, nullptr, - 0 }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } -}; - -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * kde4be1_component_getFactory( - char const * pImplName, void * pServiceManager, void * pRegistryKey) -{ - return cppu::component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey, services); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/backends/kde4be/kde4be1.component b/shell/source/backends/kde4be/kde4be1.component deleted file mode 100644 index 6217f1833435..000000000000 --- a/shell/source/backends/kde4be/kde4be1.component +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk index d7e63888a660..f93c617e9e66 100644 --- a/solenv/gbuild/CppunitTest.mk +++ b/solenv/gbuild/CppunitTest.mk @@ -226,7 +226,6 @@ $(call gb_CppunitTest_get_target,$(1)) : $(if $(filter $(2),$(true)),, \ $(call gb_Library_get_target,vclplug_gen) \ $(if $(ENABLE_GTK),$(call gb_Library_get_target,vclplug_gtk)) \ $(if $(ENABLE_GTK3),$(call gb_Library_get_target,vclplug_gtk3)) \ - $(if $(ENABLE_KDE4),$(call gb_Library_get_target,vclplug_kde4)) \ $(if $(ENABLE_QT5),$(call gb_Library_get_target,vclplug_qt5)) \ ) else ifeq ($(OS),MACOSX) diff --git a/svtools/source/uno/fpicker.cxx b/svtools/source/uno/fpicker.cxx index 8db886d5cd1f..e367a326e5c7 100644 --- a/svtools/source/uno/fpicker.cxx +++ b/svtools/source/uno/fpicker.cxx @@ -39,12 +39,8 @@ static OUString FilePicker_getSystemPickerServiceName() { #ifdef UNX OUString aDesktopEnvironment (Application::GetDesktopEnvironment()); - if (aDesktopEnvironment.equalsIgnoreAsciiCase("tde")) - return OUString ("com.sun.star.ui.dialogs.TDEFilePicker"); - else if (aDesktopEnvironment.equalsIgnoreAsciiCase("kde")) - return OUString ("com.sun.star.ui.dialogs.KDEFilePicker"); - else if (aDesktopEnvironment.equalsIgnoreAsciiCase("kde4")) - return OUString ("com.sun.star.ui.dialogs.KDE4FilePicker"); + if (aDesktopEnvironment.equalsIgnoreAsciiCase("kde5")) + return OUString ("com.sun.star.ui.dialogs.KDE5FilePicker"); else if (aDesktopEnvironment.equalsIgnoreAsciiCase("macosx")) return OUString ("com.sun.star.ui.dialogs.AquaFilePicker"); else @@ -117,9 +113,7 @@ static OUString FolderPicker_getSystemPickerServiceName() { #ifdef UNX OUString aDesktopEnvironment (Application::GetDesktopEnvironment()); - if (aDesktopEnvironment.equalsIgnoreAsciiCase("tde")) - return OUString("com.sun.star.ui.dialogs.TDEFolderPicker"); - else if (aDesktopEnvironment.equalsIgnoreAsciiCase("kde")) + if (aDesktopEnvironment.equalsIgnoreAsciiCase("kde5")) return OUString("com.sun.star.ui.dialogs.KDEFolderPicker"); else if (aDesktopEnvironment.equalsIgnoreAsciiCase("macosx")) return OUString("com.sun.star.ui.dialogs.AquaFolderPicker"); diff --git a/sysui/CustomTarget_share.mk b/sysui/CustomTarget_share.mk index d4f24b5f8e60..b0a1577d4beb 100644 --- a/sysui/CustomTarget_share.mk +++ b/sysui/CustomTarget_share.mk @@ -12,8 +12,6 @@ include $(SRCDIR)/sysui/productlist.mk ifeq ($(ENABLE_GIO),TRUE) brand_URIPARAM := --urls -else ifeq ($(ENABLE_KDE4),TRUE) - brand_URIPARAM := --urls else ifeq ($(ENABLE_QT5),TRUE) brand_URIPARAM := --urls else diff --git a/vcl/CustomTarget_kde4_moc.mk b/vcl/CustomTarget_kde4_moc.mk deleted file mode 100644 index 16d1561944c6..000000000000 --- a/vcl/CustomTarget_kde4_moc.mk +++ /dev/null @@ -1,24 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# 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/. -# - -$(eval $(call gb_CustomTarget_CustomTarget,vcl/unx/kde4)) - -$(call gb_CustomTarget_get_target,vcl/unx/kde4) : \ - $(call gb_CustomTarget_get_workdir,vcl/unx/kde4)/KDEXLib.moc \ - $(call gb_CustomTarget_get_workdir,vcl/unx/kde4)/KDE4FilePicker.moc \ - $(call gb_CustomTarget_get_workdir,vcl/unx/kde4)/tst_exclude_socket_notifiers.moc \ - $(call gb_CustomTarget_get_workdir,vcl/unx/kde4)/tst_exclude_posted_events.moc - -$(call gb_CustomTarget_get_workdir,vcl/unx/kde4)/%.moc : \ - $(SRCDIR)/vcl/unx/kde4/%.hxx \ - | $(call gb_CustomTarget_get_workdir,vcl/unx/kde4)/.dir - $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),MOC,1) - $(MOC4) $< -o $@ - -# vim: set noet sw=4: diff --git a/vcl/Library_vclplug_kde4.mk b/vcl/Library_vclplug_kde4.mk deleted file mode 100644 index 88dfd50f41f7..000000000000 --- a/vcl/Library_vclplug_kde4.mk +++ /dev/null @@ -1,99 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# 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 . -# - -$(eval $(call gb_Library_Library,vclplug_kde4)) - -$(eval $(call gb_Library_use_custom_headers,vclplug_kde4,vcl/unx/kde4)) - -$(eval $(call gb_Library_set_include,vclplug_kde4,\ - $$(INCLUDE) \ - -I$(SRCDIR)/vcl/inc \ -)) - -$(eval $(call gb_Library_add_defs,vclplug_kde4,\ - -DVCLPLUG_KDE4_IMPLEMENTATION \ -)) - -$(eval $(call gb_Library_use_sdk_api,vclplug_kde4)) - -$(eval $(call gb_Library_use_libraries,vclplug_kde4,\ - vclplug_gen \ - vcl \ - tl \ - utl \ - sot \ - ucbhelper \ - basegfx \ - comphelper \ - cppuhelper \ - i18nlangtag \ - i18nutil \ - $(if $(ENABLE_JAVA), \ - jvmaccess) \ - cppu \ - sal \ -)) - -$(eval $(call gb_Library_use_externals,vclplug_kde4,\ - boost_headers \ - harfbuzz \ - icuuc \ - kde4 \ - epoxy \ -)) - -$(eval $(call gb_Library_add_libs,vclplug_kde4,\ - -lX11 \ - -lXext \ - -lSM \ - -lICE \ -)) - -ifneq ($(KDE4_HAVE_GLIB),) -$(eval $(call gb_Library_add_defs,vclplug_kde4,\ - $(KDE4_GLIB_CFLAGS) \ -)) - -$(eval $(call gb_Library_add_libs,vclplug_kde4,\ - $(KDE4_GLIB_LIBS) \ -)) -endif - - -$(eval $(call gb_Library_add_exception_objects,vclplug_kde4,\ - vcl/unx/kde4/KDEData \ - vcl/unx/kde4/KDE4FilePicker \ - vcl/unx/kde4/KDESalDisplay \ - vcl/unx/kde4/KDESalFrame \ - vcl/unx/kde4/KDESalGraphics \ - vcl/unx/kde4/KDESalInstance \ - vcl/unx/kde4/KDEXLib \ - vcl/unx/kde4/main \ - vcl/unx/kde4/VCLKDEApplication \ -)) - -ifeq ($(OS),LINUX) -$(eval $(call gb_Library_add_libs,vclplug_kde4,\ - -lm \ - -ldl \ - -lpthread \ -)) -endif - -# vim: set noet sw=4 ts=4: diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index baef5f31e34e..95dd579c38de 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -75,13 +75,6 @@ $(eval $(call gb_Module_add_targets,vcl,\ Library_vclplug_gtk3 \ )) endif -ifneq ($(ENABLE_KDE4),) -$(eval $(call gb_Module_add_targets,vcl,\ - CustomTarget_kde4_moc \ - Library_vclplug_kde4 \ -)) -endif - ifneq ($(ENABLE_KDE5),) $(eval $(call gb_Module_add_targets,vcl,\ CustomTarget_kde5_moc \ diff --git a/vcl/README b/vcl/README index 1169cdf1f660..9219c30b5b46 100644 --- a/vcl/README +++ b/vcl/README @@ -38,12 +38,10 @@ unx/ + GTK2 support gtk3/ + GTK3 support - kde4/ - + KDE4 support kde5/ - + KDE5 support (under construction) + + KDE5 support gtk3_kde5/ - + GTK3 support with KDE5 file pickers (until kde5 is finished) + + GTK3 support with KDE5 file pickers (alternative to native kde5 one) generic/ + raw X11 support diff --git a/vcl/README.scheduler b/vcl/README.scheduler index b7d7b61b30f7..23decf3b7ec2 100644 --- a/vcl/README.scheduler +++ b/vcl/README.scheduler @@ -273,7 +273,7 @@ now need O(log(n)) to find the position in the queue of the priority. Currently Application::Reschedule() processes a single event or "all" events, with "all" defined as "100 events" in most backends. This already is ignored -by the KDE4 backend, as Qt defines its QAbstractEventDispatcher::processEvents +by the KDE backend, as Qt defines its QAbstractEventDispatcher::processEvents processing all pending events (there are ways to skip event classes, but no easy way to process just a single event). @@ -342,4 +342,4 @@ priority idle in the event loop. A few layers of indirection make this code hard to follow. The SalXLib::Yield and SalX11Display::Yield architecture makes it impossible to process just the current events. This really needs a refactoring and rearchitecture step, which -will also affect the Gtk+ and KDE4 backend for the user event handling. +will also affect the Gtk+ and KDE backend for the user event handling. diff --git a/vcl/inc/vclpluginapi.h b/vcl/inc/vclpluginapi.h index fb3350e43a1f..495c86b8e57b 100644 --- a/vcl/inc/vclpluginapi.h +++ b/vcl/inc/vclpluginapi.h @@ -35,12 +35,6 @@ #define VCLPLUG_GTK_PUBLIC SAL_DLLPUBLIC_IMPORT #endif -#if defined VCLPLUG_KDE4_IMPLEMENTATION -#define VCLPLUG_KDE4_PUBLIC SAL_DLLPUBLIC_EXPORT -#else -#define VCLPLUG_KDE4_PUBLIC SAL_DLLPUBLIC_IMPORT -#endif - #if defined VCLPLUG_KDE5_IMPLEMENTATION #define VCLPLUG_KDE5_PUBLIC SAL_DLLPUBLIC_EXPORT #else diff --git a/vcl/source/app/salplug.cxx b/vcl/source/app/salplug.cxx index 3a3421179274..938780d11879 100644 --- a/vcl/source/app/salplug.cxx +++ b/vcl/source/app/salplug.cxx @@ -97,7 +97,7 @@ SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = false ) * #i109007# KDE3 seems to have the same problem. * And same applies for KDE4. */ - if( rModuleBase == "gtk" || rModuleBase == "gtk3" || rModuleBase == "kde4" || rModuleBase == "gtk3_kde5" || rModuleBase == "win" ) + if( rModuleBase == "gtk" || rModuleBase == "gtk3" || rModuleBase == "gtk3_kde5" || rModuleBase == "win" ) { pCloseModule = nullptr; } @@ -155,9 +155,6 @@ SalInstance* autodetect_plugin() #endif #if ENABLE_GTK3_KDE5 "gtk3_kde5", -#endif -#if ENABLE_KDE4 - "kde4", #endif "gtk3", "gtk", "gen", nullptr }; diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index 882f35d424af..356710a71d2a 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -961,7 +961,7 @@ bool OpenGLHelper::isVCLOpenGLEnabled() return false; //tdf#106155, disable GL while loading certain bitmaps needed for the initial toplevel windows - //under raw X (kde4) vclplug + //under raw X (kde) vclplug if (bTempOpenGLDisabled) return false; diff --git a/vcl/unx/kde4/FPServiceInfo.hxx b/vcl/unx/kde4/FPServiceInfo.hxx deleted file mode 100644 index fdb285144343..000000000000 --- a/vcl/unx/kde4/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/kde4/KDE4FilePicker.cxx b/vcl/unx/kde4/KDE4FilePicker.cxx deleted file mode 100644 index 5454344b949d..000000000000 --- a/vcl/unx/kde4/KDE4FilePicker.cxx +++ /dev/null @@ -1,823 +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 "KDE4FilePicker.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include "FPServiceInfo.hxx" -#include "VCLKDEApplication.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#undef Region - -#include - -#include - -// The dialog should check whether LO also supports the protocol -// provided by KIO, and KFileWidget::dirOperator() is only 4.3+ . -// Moreover it's only in this somewhat internal KFileWidget class, -// which may not necessarily be what KFileDialog::fileWidget() returns, -// but that's hopefully not a problem in practice. -#if KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2 -#define ALLOW_REMOTE_URLS 1 -#else -#define ALLOW_REMOTE_URLS 0 -#endif - -// helper functions - -#include - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::ui::dialogs; -using namespace ::com::sun::star::ui::dialogs::TemplateDescription; -using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds; -using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::uno; - -namespace -{ - uno::Sequence FilePicker_getSupportedServiceNames() - { - uno::Sequence aRet(3); - aRet[0] = "com.sun.star.ui.dialogs.FilePicker"; - aRet[1] = "com.sun.star.ui.dialogs.SystemFilePicker"; - aRet[2] = "com.sun.star.ui.dialogs.KDE4FilePicker"; - return aRet; - } -} - -static OUString toOUString(const QString& s) -{ - // QString stores UTF16, just like OUString - return OUString(reinterpret_cast(s.data()), s.length()); -} - -static QString toQString(const OUString& s) -{ - return QString::fromUtf16( - reinterpret_cast(s.getStr()), s.getLength()); -} - -// KDE4FilePicker - -KDE4FilePicker::KDE4FilePicker( const uno::Reference& ) - : KDE4FilePicker_Base(_helperMutex) - , allowRemoteUrls( false ) -{ - _extraControls = new QWidget(); - _layout = new QGridLayout(_extraControls); - - _dialog = new KFileDialog(KUrl("~"), QString(""), nullptr, _extraControls); -#if ALLOW_REMOTE_URLS - if( KFileWidget* fileWidget = dynamic_cast< KFileWidget* >( _dialog->fileWidget())) - { - allowRemoteUrls = true; - // Use finishedLoading signal rather than e.g. urlEntered, because if there's a problem - // such as the URL being mistyped, there's no way to prevent two message boxes about it, - // one from us and one from KDE code. - connect( fileWidget->dirOperator(), SIGNAL( finishedLoading()), SLOT( checkProtocol())); - } -#endif - - setMultiSelectionMode( false ); - - // XExecutableDialog functions - connect( this, SIGNAL( setTitleSignal( const OUString & ) ), - this, SLOT( setTitleSlot( const OUString & ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( executeSignal() ), - this, SLOT( executeSlot() ), Qt::BlockingQueuedConnection ); - - // XFilePicker functions - connect( this, SIGNAL( setMultiSelectionModeSignal( bool ) ), - this, SLOT( setMultiSelectionModeSlot( bool ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( setDefaultNameSignal( const OUString & ) ), - this, SLOT( setDefaultNameSlot( const OUString & ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( setDisplayDirectorySignal( const OUString & ) ), - this, SLOT( setDisplayDirectorySlot( const OUString & ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( getDisplayDirectorySignal() ), - this, SLOT( getDisplayDirectorySlot() ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( getFilesSignal() ), - this, SLOT( getFilesSlot() ), Qt::BlockingQueuedConnection ); - - // XFilterManager functions - connect( this, SIGNAL( appendFilterSignal( const OUString &, const OUString & ) ), - this, SLOT( appendFilterSlot( const OUString &, const OUString & ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( setCurrentFilterSignal( const OUString & ) ), - this, SLOT( setCurrentFilterSlot( const OUString & ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( getCurrentFilterSignal() ), - this, SLOT( getCurrentFilterSlot() ), Qt::BlockingQueuedConnection ); - - // XFilterGroupManager functions - connect( this, SIGNAL( appendFilterGroupSignal( const OUString &, const css::uno::Sequence< css::beans::StringPair > & ) ), - this, SLOT( appendFilterGroupSlot( const OUString &, const css::uno::Sequence< css::beans::StringPair > & ) ), Qt::BlockingQueuedConnection ); - - // XFilePickerControlAccess functions - connect( this, SIGNAL( setValueSignal( sal_Int16, sal_Int16, const css::uno::Any & ) ), - this, SLOT( setValueSlot( sal_Int16, sal_Int16, const css::uno::Any & ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( getValueSignal( sal_Int16, sal_Int16 ) ), - this, SLOT( getValueSlot( sal_Int16, sal_Int16 ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( enableControlSignal( sal_Int16, bool ) ), - this, SLOT( enableControlSlot( sal_Int16, bool ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( setLabelSignal( sal_Int16, const OUString & ) ), - this, SLOT( setLabelSlot( sal_Int16, const OUString & ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( getLabelSignal( sal_Int16 ) ), - this, SLOT( getLabelSlot( sal_Int16 ) ), Qt::BlockingQueuedConnection ); - - // XFilePicker2 functions - connect( this, SIGNAL( getSelectedFilesSignal() ), - this, SLOT( getSelectedFilesSlot() ), Qt::BlockingQueuedConnection ); - - // XInitialization - connect( this, SIGNAL( initializeSignal( const css::uno::Sequence< css::uno::Any > & ) ), - this, SLOT( initializeSlot( const css::uno::Sequence< css::uno::Any > & ) ), Qt::BlockingQueuedConnection ); - - // Destructor proxy - connect( this, SIGNAL( cleanupProxySignal() ), this, SLOT( cleanupProxy() ), Qt::BlockingQueuedConnection ); - - connect( this, SIGNAL( checkProtocolSignal() ), this, SLOT( checkProtocol() ), Qt::BlockingQueuedConnection ); - - // XFilePickerListener notifications - connect( _dialog, SIGNAL( filterChanged(const QString&) ), this, SLOT( filterChanged(const QString&) )); - connect( _dialog, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() )); -} - -KDE4FilePicker::~KDE4FilePicker() -{ - cleanupProxy(); -} - -void KDE4FilePicker::cleanupProxy() -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT cleanupProxySignal(); - } - delete _dialog; -} - -void SAL_CALL KDE4FilePicker::addFilePickerListener( const uno::Reference& xListener ) -{ - SolarMutexGuard aGuard; - m_xListener = xListener; -} - -void SAL_CALL KDE4FilePicker::removeFilePickerListener( const uno::Reference& ) -{ - SolarMutexGuard aGuard; - m_xListener.clear(); -} - -void SAL_CALL KDE4FilePicker::setTitle( const OUString &title ) -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT setTitleSignal( title ); - } - - _dialog->setCaption(toQString(title)); -} - -sal_Int16 SAL_CALL KDE4FilePicker::execute() -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT executeSignal(); - } - - //get the window id of the main OO window to set it for the dialog as a parent - vcl::Window *pParentWin = Application::GetDefDialogParent(); - if ( pParentWin ) - { - const SystemEnvData* pSysData = pParentWin->GetSystemData(); - if ( pSysData ) - { - KWindowSystem::setMainWindow( _dialog, pSysData->aWindow); // unx only - } - } - - _dialog->clearFilter(); - _dialog->setFilter(_filter); - - if(!_currentFilter.isNull()) - _dialog->filterWidget()->setCurrentItem(_currentFilter); - - _dialog->filterWidget()->setEditable(false); - - VCLKDEApplication::preDialogSetup(); - //block and wait for user input - int result = _dialog->exec(); - VCLKDEApplication::postDialogCleanup(); - if( result == KFileDialog::Accepted ) - return ExecutableDialogResults::OK; - - return ExecutableDialogResults::CANCEL; -} - -void SAL_CALL KDE4FilePicker::setMultiSelectionMode( sal_Bool multiSelect ) -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT setMultiSelectionModeSignal( multiSelect ); - } - - if( allowRemoteUrls ) - { - if (multiSelect) - _dialog->setMode(KFile::Files); - else - _dialog->setMode(KFile::File); - } - else - { - if (multiSelect) - _dialog->setMode(KFile::Files | KFile::LocalOnly); - else - _dialog->setMode(KFile::File | KFile::LocalOnly); - } -} - -void SAL_CALL KDE4FilePicker::setDefaultName( const OUString &name ) -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT setDefaultNameSignal( name ); - } - - const QString url = toQString(name); - _dialog->setSelection(url); -} - -void SAL_CALL KDE4FilePicker::setDisplayDirectory( const OUString &dir ) -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT setDisplayDirectorySignal( dir ); - } - - const QString url = toQString(dir); - _dialog->setUrl(KUrl(url)); -} - -OUString SAL_CALL KDE4FilePicker::getDisplayDirectory() -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT getDisplayDirectorySignal(); - } - - QString dir = _dialog->baseUrl().url(); - return toOUString(dir); -} - -uno::Sequence< OUString > SAL_CALL KDE4FilePicker::getFiles() -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT getFilesSignal(); - } - uno::Sequence< OUString > seq = getSelectedFiles(); - if (seq.getLength() > 1) - seq.realloc(1); - return seq; -} - -uno::Sequence< OUString > SAL_CALL KDE4FilePicker::getSelectedFiles() -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT getSelectedFilesSignal(); - } - KUrl::List urls = _dialog->selectedUrls(); - uno::Sequence< OUString > seq( urls.size()); - int i = 0; - foreach( const KUrl& url, urls ) - seq[ i++ ]= toOUString( url.url()); - return seq; -} - -void SAL_CALL KDE4FilePicker::appendFilter( const OUString &title, const OUString &filter ) -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT appendFilterSignal( title, filter ); - } - - QString t = toQString(title); - QString f = toQString(filter); - - if (!_filter.isNull()) - _filter.append("\n"); - - // '/' need to be escaped else they are assumed to be mime types by kfiledialog - //see the docs - t.replace("/", "\\/"); - - // openoffice gives us filters separated by ';' qt dialogs just want space separated - f.replace(";", " "); - - // make sure "*.*" is not used as "all files" - f.replace("*.*", "*"); - - _filter.append(QString("%1|%2").arg(f).arg(t)); -} - -void SAL_CALL KDE4FilePicker::setCurrentFilter( const OUString &title ) -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT setCurrentFilterSignal( title ); - } - - _currentFilter = toQString(title); -} - -OUString SAL_CALL KDE4FilePicker::getCurrentFilter() -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT getCurrentFilterSignal(); - } - - // _dialog->currentFilter() wouldn't quite work, because it returns only e.g. "*.doc", - // without the description, and there may be several filters with the same pattern - QString filter = _dialog->filterWidget()->currentText(); - filter = filter.mid( filter.indexOf( '|' ) + 1 ); // convert from the pattern|description format if needed - filter.replace( "\\/", "/" ); - - //default if not found - if (filter.isNull()) - filter = "ODF Text Document (.odt)"; - - return toOUString(filter); -} - -void SAL_CALL KDE4FilePicker::appendFilterGroup( const OUString& rGroupTitle, const uno::Sequence& filters) -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT appendFilterGroupSignal( rGroupTitle, filters ); - } - - const sal_uInt16 length = filters.getLength(); - for (sal_uInt16 i = 0; i < length; ++i) - { - beans::StringPair aPair = filters[i]; - appendFilter( aPair.First, aPair.Second ); - } -} - -void SAL_CALL KDE4FilePicker::setValue( sal_Int16 controlId, sal_Int16 nControlAction, const uno::Any &value ) -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT setValueSignal( controlId, nControlAction, value ); - } - - if (_customWidgets.contains( controlId )) { - QCheckBox* cb = dynamic_cast( _customWidgets.value( controlId )); - if (cb) - cb->setChecked(value.get()); - } - else - SAL_WARN( "vcl", "set label on unknown control " << controlId ); -} - -uno::Any SAL_CALL KDE4FilePicker::getValue( sal_Int16 controlId, sal_Int16 nControlAction ) -{ - if (CHECKBOX_AUTOEXTENSION == controlId) - // We ignore this one and rely on KFileDialog to provide the function. - // Always return false, to pretend we do not support this, otherwise - // LO core would try to be smart and cut the extension in some places, - // interfering with KFileDialog's handling of it. KFileDialog also - // saves the value of the setting, so LO core is not needed for that either. - return uno::Any( false ); - - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT getValueSignal( controlId, nControlAction ); - } - - uno::Any res(false); - if (_customWidgets.contains( controlId )) { - QCheckBox* cb = dynamic_cast( _customWidgets.value( controlId )); - if (cb) - res <<= cb->isChecked(); - } - else - SAL_WARN( "vcl", "get value on unknown control " << controlId ); - - return res; -} - -void SAL_CALL KDE4FilePicker::enableControl( sal_Int16 controlId, sal_Bool enable ) -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT enableControlSignal( controlId, enable ); - } - - if (_customWidgets.contains( controlId )) - _customWidgets.value( controlId )->setEnabled( enable ); - else - SAL_WARN( "vcl", "enable unknown control " << controlId ); -} - -void SAL_CALL KDE4FilePicker::setLabel( sal_Int16 controlId, const OUString &label ) -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT setLabelSignal( controlId, label ); - } - - if (_customWidgets.contains( controlId )) { - QCheckBox* cb = dynamic_cast( _customWidgets.value( controlId )); - if (cb) - cb->setText( toQString(label) ); - } - else - SAL_WARN( "vcl", "set label on unknown control " << controlId ); -} - -OUString SAL_CALL KDE4FilePicker::getLabel(sal_Int16 controlId) -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT getLabelSignal( controlId ); - } - - QString label; - if (_customWidgets.contains( controlId )) { - QCheckBox* cb = dynamic_cast( _customWidgets.value( controlId )); - if (cb) - label = cb->text(); - } - else - SAL_WARN( "vcl", "get label on unknown control " << controlId ); - - return toOUString(label); -} - -QString KDE4FilePicker::getResString(const char *pResId) -{ - QString aResString; - - if (pResId == nullptr) - return aResString; - - aResString = toQString(VclResId(pResId)); - - return aResString.replace('~', '&'); -} - -void KDE4FilePicker::addCustomControl(sal_Int16 controlId) -{ - QWidget* widget = nullptr; - const char* resId = nullptr; - - switch (controlId) - { - case CHECKBOX_AUTOEXTENSION: - resId = STR_FPICKER_AUTO_EXTENSION; - break; - case CHECKBOX_PASSWORD: - resId = STR_FPICKER_PASSWORD; - break; - case CHECKBOX_GPGENCRYPTION: - resId = STR_FPICKER_GPGENCRYPT; - break; - case CHECKBOX_FILTEROPTIONS: - resId = STR_FPICKER_FILTER_OPTIONS; - break; - case CHECKBOX_READONLY: - resId = STR_FPICKER_READONLY; - break; - case CHECKBOX_LINK: - resId = STR_FPICKER_INSERT_AS_LINK; - break; - case CHECKBOX_PREVIEW: - resId = STR_FPICKER_SHOW_PREVIEW; - break; - case CHECKBOX_SELECTION: - resId = STR_FPICKER_SELECTION; - break; - case PUSHBUTTON_PLAY: - resId = STR_FPICKER_PLAY; - break; - case LISTBOX_VERSION: - resId = STR_FPICKER_VERSION; - break; - case LISTBOX_TEMPLATE: - resId = STR_FPICKER_TEMPLATES; - break; - case LISTBOX_IMAGE_TEMPLATE: - resId = STR_FPICKER_IMAGE_TEMPLATE; - break; - case LISTBOX_IMAGE_ANCHOR: - resId = STR_FPICKER_IMAGE_ANCHOR; - break; - case LISTBOX_VERSION_LABEL: - case LISTBOX_TEMPLATE_LABEL: - case LISTBOX_IMAGE_TEMPLATE_LABEL: - case LISTBOX_IMAGE_ANCHOR_LABEL: - case LISTBOX_FILTER_SELECTOR: - break; - } - - switch (controlId) - { - case CHECKBOX_AUTOEXTENSION: - case CHECKBOX_PASSWORD: - case CHECKBOX_GPGENCRYPTION: - case CHECKBOX_FILTEROPTIONS: - case CHECKBOX_READONLY: - case CHECKBOX_LINK: - case CHECKBOX_PREVIEW: - case CHECKBOX_SELECTION: - { - widget = new QCheckBox(getResString(resId), _extraControls); - - // the checkbox is created even for CHECKBOX_AUTOEXTENSION to simplify - // code, but the checkbox is hidden and ignored - if( controlId == CHECKBOX_AUTOEXTENSION ) - widget->hide(); - - break; - } - case PUSHBUTTON_PLAY: - case LISTBOX_VERSION: - case LISTBOX_TEMPLATE: - case LISTBOX_IMAGE_TEMPLATE: - case LISTBOX_IMAGE_ANCHOR: - case LISTBOX_VERSION_LABEL: - case LISTBOX_TEMPLATE_LABEL: - case LISTBOX_IMAGE_TEMPLATE_LABEL: - case LISTBOX_IMAGE_ANCHOR_LABEL: - case LISTBOX_FILTER_SELECTOR: - break; - } - - if (widget) - { - _layout->addWidget(widget); - _customWidgets.insert(controlId, widget); - } -} - -void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence &args ) -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT initializeSignal( args ); - } - - _filter.clear(); - _currentFilter.clear(); - - // parameter checking - uno::Any arg; - if (args.getLength() == 0) - { - throw lang::IllegalArgumentException( - "no arguments", - static_cast< XFilePicker2* >( this ), 1 ); - } - - arg = args[0]; - - if (( arg.getValueType() != cppu::UnoType::get()) && - ( arg.getValueType() != cppu::UnoType::get())) - { - throw lang::IllegalArgumentException( - "invalid argument type", - static_cast< XFilePicker2* >( this ), 1 ); - } - - sal_Int16 templateId = -1; - arg >>= templateId; - - //default is opening - KFileDialog::OperationMode operationMode = KFileDialog::Opening; - - switch ( templateId ) - { - case FILEOPEN_SIMPLE: - break; - - case FILESAVE_SIMPLE: - operationMode = KFileDialog::Saving; - break; - - case FILESAVE_AUTOEXTENSION: - operationMode = KFileDialog::Saving; - addCustomControl( CHECKBOX_AUTOEXTENSION ); - break; - - case FILESAVE_AUTOEXTENSION_PASSWORD: - { - operationMode = KFileDialog::Saving; - addCustomControl( CHECKBOX_PASSWORD ); - addCustomControl( CHECKBOX_GPGENCRYPTION ); - break; - } - case FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS: - { - operationMode = KFileDialog::Saving; - addCustomControl( CHECKBOX_AUTOEXTENSION ); - addCustomControl( CHECKBOX_PASSWORD ); - addCustomControl( CHECKBOX_GPGENCRYPTION ); - addCustomControl( CHECKBOX_FILTEROPTIONS ); - break; - } - case FILESAVE_AUTOEXTENSION_SELECTION: - operationMode = KFileDialog::Saving; - addCustomControl( CHECKBOX_AUTOEXTENSION ); - addCustomControl( CHECKBOX_SELECTION ); - break; - - case FILESAVE_AUTOEXTENSION_TEMPLATE: - operationMode = KFileDialog::Saving; - addCustomControl( CHECKBOX_AUTOEXTENSION ); - addCustomControl( LISTBOX_TEMPLATE ); - break; - - case FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE: - addCustomControl( CHECKBOX_LINK ); - addCustomControl( CHECKBOX_PREVIEW ); - addCustomControl( LISTBOX_IMAGE_TEMPLATE ); - break; - - case FILEOPEN_LINK_PREVIEW_IMAGE_ANCHOR: - addCustomControl( CHECKBOX_LINK ); - addCustomControl( CHECKBOX_PREVIEW ); - addCustomControl( LISTBOX_IMAGE_ANCHOR ); - break; - - case FILEOPEN_PLAY: - addCustomControl( PUSHBUTTON_PLAY ); - break; - - case FILEOPEN_LINK_PLAY: - addCustomControl( CHECKBOX_LINK ); - addCustomControl( PUSHBUTTON_PLAY ); - break; - - case FILEOPEN_READONLY_VERSION: - addCustomControl( CHECKBOX_READONLY ); - addCustomControl( LISTBOX_VERSION ); - break; - - case FILEOPEN_LINK_PREVIEW: - addCustomControl( CHECKBOX_LINK ); - addCustomControl( CHECKBOX_PREVIEW ); - break; - - case FILEOPEN_PREVIEW: - addCustomControl( CHECKBOX_PREVIEW ); - break; - - default: - throw lang::IllegalArgumentException( - "Unknown template", - static_cast< XFilePicker2* >( this ), - 1 ); - } - - _dialog->setOperationMode( operationMode ); - - const char *resId = nullptr; - switch (_dialog->operationMode()) - { - case KFileDialog::Opening: - resId = STR_FPICKER_OPEN; - break; - case KFileDialog::Saving: - resId = STR_FPICKER_SAVE; - _dialog->setConfirmOverwrite( true ); - break; - default: - break; - } - - _dialog->setCaption(getResString(resId)); -} - -void SAL_CALL KDE4FilePicker::cancel() -{ - -} - -void KDE4FilePicker::disposing( const lang::EventObject &rEvent ) -{ - uno::Reference xFilePickerListener( rEvent.Source, uno::UNO_QUERY ); - - if ( xFilePickerListener.is() ) - { - removeFilePickerListener( xFilePickerListener ); - } -} - -OUString SAL_CALL KDE4FilePicker::getImplementationName() -{ - return OUString( FILE_PICKER_IMPL_NAME ); -} - -sal_Bool SAL_CALL KDE4FilePicker::supportsService( const OUString& ServiceName ) -{ - return cppu::supportsService(this, ServiceName); -} - -uno::Sequence< OUString > SAL_CALL KDE4FilePicker::getSupportedServiceNames() -{ - return FilePicker_getSupportedServiceNames(); -} - -void KDE4FilePicker::checkProtocol() -{ - if( qApp->thread() != QThread::currentThread() ) { - SolarMutexReleaser aReleaser; - return Q_EMIT checkProtocolSignal(); - } - - // There's no libreoffice.desktop :(, so find a matching one. - KService::List services = KServiceTypeTrader::self()->query( "Application", "Exec =~ 'libreoffice %U'" ); - QStringList protocols; - if( !services.isEmpty()) - protocols = services[ 0 ]->property( "X-KDE-Protocols" ).toStringList(); - if( protocols.isEmpty()) // incorrect (developer?) installation ? - protocols << "file" << "http"; - if( !protocols.contains( _dialog->baseUrl().protocol()) && !protocols.contains( "KIO" )) - KMessageBox::error( _dialog, KIO::buildErrorString( KIO::ERR_UNSUPPORTED_PROTOCOL, _dialog->baseUrl().protocol())); -} - -void KDE4FilePicker::filterChanged(const QString &) -{ - FilePickerEvent aEvent; - aEvent.ElementId = LISTBOX_FILTER; - SAL_INFO( "vcl", "filter changed" ); - if (m_xListener.is()) - m_xListener->controlStateChanged( aEvent ); -} - -void KDE4FilePicker::selectionChanged() -{ - FilePickerEvent aEvent; - SAL_INFO( "vcl", "file selection changed" ); - if (m_xListener.is()) - m_xListener->fileSelectionChanged( aEvent ); -} - -#include - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDE4FilePicker.hxx b/vcl/unx/kde4/KDE4FilePicker.hxx deleted file mode 100644 index f0b37452ef3d..000000000000 --- a/vcl/unx/kde4/KDE4FilePicker.hxx +++ /dev/null @@ -1,258 +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 - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include - -class KFileDialog; -class QWidget; -class QLayout; - -typedef ::cppu::WeakComponentImplHelper -< css::ui::dialogs::XFilePicker3 -, css::ui::dialogs::XFilePickerControlAccess -// TODO css::ui::dialogs::XFilePreview -, css::lang::XInitialization -, css::lang::XServiceInfo -> KDE4FilePicker_Base; - -class KDE4FilePicker - : public QObject - , public KDE4FilePicker_Base -{ - Q_OBJECT -protected: - - css::uno::Reference< css::ui::dialogs::XFilePickerListener > m_xListener; - - //the dialog to display - KFileDialog* _dialog; - - osl::Mutex _helperMutex; - - //running filter string to add to dialog - QString _filter; - // string to set the current filter - QString _currentFilter; - - //mapping of SAL control ID's to created custom controls - QHash _customWidgets; - - //widget to contain extra custom controls - QWidget* _extraControls; - - //layout for extra custom controls - QLayout* _layout; - - bool allowRemoteUrls; - -public: - explicit KDE4FilePicker( const css::uno::Reference< css::uno::XComponentContext >& ); - virtual ~KDE4FilePicker() override; - - // XFilePickerNotifier - virtual void SAL_CALL addFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener ) override; - virtual void SAL_CALL removeFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener ) override; - - // XExecutableDialog functions - virtual void SAL_CALL setTitle( const OUString &rTitle ) override; - virtual sal_Int16 SAL_CALL execute() override; - - // XFilePicker functions - virtual void SAL_CALL setMultiSelectionMode( sal_Bool bMode ) override; - virtual void SAL_CALL setDefaultName( const OUString &rName ) override; - virtual void SAL_CALL setDisplayDirectory( const OUString &rDirectory ) override; - virtual OUString SAL_CALL getDisplayDirectory() override; - virtual css::uno::Sequence< OUString > SAL_CALL getFiles() override; - - // XFilterManager functions - virtual void SAL_CALL appendFilter( const OUString &rTitle, const OUString &rFilter ) override; - virtual void SAL_CALL setCurrentFilter( const OUString &rTitle ) override; - virtual OUString SAL_CALL getCurrentFilter() override; - - // XFilterGroupManager functions - virtual void SAL_CALL appendFilterGroup( const OUString &rGroupTitle, const css::uno::Sequence< css::beans::StringPair > &rFilters ) override; - - // XFilePickerControlAccess functions - virtual void SAL_CALL setValue( sal_Int16 nControlId, sal_Int16 nControlAction, const css::uno::Any &rValue ) override; - virtual css::uno::Any SAL_CALL getValue( sal_Int16 nControlId, sal_Int16 nControlAction ) override; - virtual void SAL_CALL enableControl( sal_Int16 nControlId, sal_Bool bEnable ) override; - virtual void SAL_CALL setLabel( sal_Int16 nControlId, const OUString &rLabel ) override; - virtual OUString SAL_CALL getLabel( sal_Int16 nControlId ) override; - - /* TODO XFilePreview - - virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( ) throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getTargetColorDepth( ) throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getAvailableWidth( ) throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getAvailableHeight( ) throw (css::uno::RuntimeException); - virtual void SAL_CALL setImage( sal_Int16 aImageFormat, const css::uno::Any &rImage ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState ) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getShowState( ) throw (css::uno::RuntimeException); - */ - - // XFilePicker2 functions - virtual css::uno::Sequence< OUString > SAL_CALL getSelectedFiles() override; - - // XInitialization - virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any > &rArguments ) override; - - // XCancellable - virtual void SAL_CALL cancel( ) override; - - // XEventListener - /// @throws css::uno::RuntimeException - virtual void disposing( const css::lang::EventObject &rEvent ); - using cppu::WeakComponentImplHelperBase::disposing; - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() override; - virtual sal_Bool SAL_CALL supportsService( const OUString &rServiceName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - -private Q_SLOTS: - // XExecutableDialog functions - /// @throws css::uno::RuntimeException - void setTitleSlot( const OUString &rTitle ) { return setTitle( rTitle ); } - /// @throws css::uno::RuntimeException - sal_Int16 executeSlot() { return execute(); } - - // XFilePicker functions - /// @throws css::uno::RuntimeException - void setMultiSelectionModeSlot( bool bMode ) { return setMultiSelectionMode( bMode ); } - /// @throws css::uno::RuntimeException - void setDefaultNameSlot( const OUString &rName ) { return setDefaultName( rName ); } - /// @throws css::uno::RuntimeException - void setDisplayDirectorySlot( const OUString &rDirectory ) { return setDisplayDirectory( rDirectory ); } - /// @throws css::uno::RuntimeException - OUString getDisplayDirectorySlot() { return getDisplayDirectory(); } - /// @throws css::uno::RuntimeException - css::uno::Sequence< OUString > getFilesSlot() { return getFiles(); } - - // XFilterManager functions - /// @throws css::lang::IllegalArgumentException - /// @throws css::uno::RuntimeException - void appendFilterSlot( const OUString &rTitle, const OUString &rFilter ) { return appendFilter( rTitle, rFilter ); } - /// @throws css::lang::IllegalArgumentException - /// @throws css::uno::RuntimeException - void setCurrentFilterSlot( const OUString &rTitle ) { return setCurrentFilter( rTitle ); } - /// @throws css::uno::RuntimeException - OUString getCurrentFilterSlot() { return getCurrentFilter(); } - - // XFilterGroupManager functions - /// @throws css::lang::IllegalArgumentException - /// @throws css::uno::RuntimeException - void appendFilterGroupSlot( const OUString &rGroupTitle, const css::uno::Sequence< css::beans::StringPair > &rFilters ) { return appendFilterGroup( rGroupTitle, rFilters ); } - - // XFilePickerControlAccess functions - /// @throws css::uno::RuntimeException - void setValueSlot( sal_Int16 nControlId, sal_Int16 nControlAction, const css::uno::Any &rValue ) { return setValue( nControlId, nControlAction, rValue ); } - /// @throws css::uno::RuntimeException - css::uno::Any getValueSlot( sal_Int16 nControlId, sal_Int16 nControlAction ) { return getValue( nControlId, nControlAction ); } - /// @throws css::uno::RuntimeException - void enableControlSlot( sal_Int16 nControlId, bool bEnable ) { return enableControl( nControlId, bEnable ); } - /// @throws css::uno::RuntimeException - void setLabelSlot( sal_Int16 nControlId, const OUString &rLabel ) { return setLabel( nControlId, rLabel ); } - /// @throws css::uno::RuntimeException - OUString getLabelSlot( sal_Int16 nControlId ) { return getLabel( nControlId ); } - - // XFilePicker2 functions - /// @throws css::uno::RuntimeException - css::uno::Sequence< OUString > getSelectedFilesSlot() { return getSelectedFiles(); } - - // XInitialization - /// @throws css::uno::Exception - /// @throws css::uno::RuntimeException - void initializeSlot( const css::uno::Sequence< css::uno::Any > &rArguments ) { return initialize( rArguments ); } - -Q_SIGNALS: - // XExecutableDialog functions - void setTitleSignal( const OUString &rTitle ); - sal_Int16 executeSignal(); - - // XFilePicker functions - void setMultiSelectionModeSignal( bool bMode ); - void setDefaultNameSignal( const OUString &rName ); - void setDisplayDirectorySignal( const OUString &rDirectory ); - OUString getDisplayDirectorySignal(); - css::uno::Sequence< OUString > getFilesSignal(); - - // XFilterManager functions - void appendFilterSignal( const OUString &rTitle, const OUString &rFilter ); - void setCurrentFilterSignal( const OUString &rTitle ); - OUString getCurrentFilterSignal(); - - // XFilterGroupManager functions - void appendFilterGroupSignal( const OUString &rGroupTitle, const css::uno::Sequence< css::beans::StringPair > &rFilters ); - - // XFilePickerControlAccess functions - void setValueSignal( sal_Int16 nControlId, sal_Int16 nControlAction, const css::uno::Any &rValue ); - css::uno::Any getValueSignal( sal_Int16 nControlId, sal_Int16 nControlAction ); - void enableControlSignal( sal_Int16 nControlId, bool bEnable ); - void setLabelSignal( sal_Int16 nControlId, const OUString &rLabel ); - OUString getLabelSignal( sal_Int16 nControlId ); - - // XFilePicker2 functions - css::uno::Sequence< OUString > getSelectedFilesSignal() ; - - // XInitialization - void initializeSignal( const css::uno::Sequence< css::uno::Any > &rArguments ); - - // Destructor proxy - void cleanupProxySignal(); - - // KDE protocol lookup - void checkProtocolSignal(); - -private: - KDE4FilePicker( const KDE4FilePicker& ) = delete; - KDE4FilePicker& operator=( const KDE4FilePicker& ) = delete; - - //add a custom control widget to the file dialog - void addCustomControl(sal_Int16 controlId); - - static QString getResString(const char* pRedId); - -private Q_SLOTS: - void cleanupProxy(); - void checkProtocol(); - - // emit XFilePickerListener controlStateChanged event - void filterChanged(const QString &filter); - // emit XFilePickerListener fileSelectionChanged event - void selectionChanged(); -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDEData.cxx b/vcl/unx/kde4/KDEData.cxx deleted file mode 100644 index 1f3d0bfcbb3c..000000000000 --- a/vcl/unx/kde4/KDEData.cxx +++ /dev/null @@ -1,68 +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 -#include - -#undef Region - -#include "KDEData.hxx" - -#include "KDEXLib.hxx" -#include "KDESalDisplay.hxx" - -KDEData::~KDEData() -{ -} - -void KDEData::Init() -{ - pXLib_.reset(new KDEXLib()); - pXLib_->Init(); - SetDisplay( SalKDEDisplay::self() ); -} - -void KDEData::initNWF() -{ - ImplSVData *pSVData = ImplGetSVData(); - - // draw toolbars on separate lines - pSVData->maNWFData.mbDockingAreaSeparateTB = true; - // no borders for menu, theming does that - pSVData->maNWFData.mbFlatMenu = true; - // Qt theme engines may support a rollover menubar - pSVData->maNWFData.mbRolloverMenubar = true; - - pSVData->maNWFData.mbNoFocusRects = true; - - // Styled menus need additional space - QStyle *style = QApplication::style(); - pSVData->maNWFData.mnMenuFormatBorderX = - style->pixelMetric( QStyle::PM_MenuPanelWidth ) + - style->pixelMetric( QStyle::PM_MenuHMargin ); - pSVData->maNWFData.mnMenuFormatBorderY = - style->pixelMetric( QStyle::PM_MenuPanelWidth ) + - style->pixelMetric( QStyle::PM_MenuVMargin ); -} - -void KDEData::deInitNWF() -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDEData.hxx b/vcl/unx/kde4/KDEData.hxx deleted file mode 100644 index 4efd23a7df34..000000000000 --- a/vcl/unx/kde4/KDEData.hxx +++ /dev/null @@ -1,37 +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 - -#include -#include - -class KDEData : public X11SalData -{ - public: - explicit KDEData( SalInstance *pInstance ) - : X11SalData( SAL_DATA_KDE4, pInstance ) {} - virtual ~KDEData() override; - - virtual void Init() override; - virtual void initNWF() override; - virtual void deInitNWF() override; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDESalDisplay.cxx b/vcl/unx/kde4/KDESalDisplay.cxx deleted file mode 100644 index 14a753e1c0a1..000000000000 --- a/vcl/unx/kde4/KDESalDisplay.cxx +++ /dev/null @@ -1,91 +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 "KDESalDisplay.hxx" - -#include "KDEXLib.hxx" -#include "VCLKDEApplication.hxx" - -#include - -SalKDEDisplay* SalKDEDisplay::selfptr = nullptr; - -SalKDEDisplay::SalKDEDisplay( Display* pDisp ) - : SalX11Display( pDisp ) -{ - assert( selfptr == nullptr ); - selfptr = this; - xim_protocol = XInternAtom( pDisp_, "_XIM_PROTOCOL", False ); -} - -SalKDEDisplay::~SalKDEDisplay() -{ - // in case never a frame opened - static_cast(GetXLib())->doStartup(); - // clean up own members - doDestruct(); - selfptr = nullptr; - // prevent SalDisplay from closing KApplication's display - pDisp_ = nullptr; -} - -void SalKDEDisplay::Yield() -{ - // Prevent blocking from Drag'n'Drop events, which may have already have processed the event - if (XEventsQueued( pDisp_, QueuedAfterReading ) == 0) - return; - - DBG_ASSERT( GetSalData()->m_pInstance->GetYieldMutex()->IsCurrentThread(), - "will crash soon since solar mutex not locked in SalKDEDisplay::Yield" ); - - XEvent event; - XNextEvent( pDisp_, &event ); - if( checkDirectInputEvent( &event )) - return; - qApp->x11ProcessEvent( &event ); -} - -// HACK: When using Qt event loop, input methods (japanese, etc.) will get broken because -// of XFilterEvent() getting called twice, once by Qt, once by LO (bnc#665112). -// This function is therefore called before any XEvent is passed to Qt event handling -// and if it is a keyboard event and no Qt widget is the active window (i.e. we are -// processing events for some LO window), then feed the event only to LO directly and skip Qt -// completely. Skipped events are KeyPress, KeyRelease and also _XIM_PROTOCOL client message -// (seems to be necessary too, hopefully there are not other internal XIM messages that -// would need this handling). -bool SalKDEDisplay::checkDirectInputEvent( XEvent* ev ) -{ - if( ev->xany.type == KeyPress || ev->xany.type == KeyRelease - || ( ev->xany.type == ClientMessage && ev->xclient.message_type == xim_protocol )) - { - if( QApplication::activeWindow() == nullptr ) - { - Dispatch(ev); - return true; - } - } - return false; -} - -void SalKDEDisplay::TriggerUserEventProcessing() -{ - static_cast(GetXLib())->TriggerUserEventProcessing(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDESalDisplay.hxx b/vcl/unx/kde4/KDESalDisplay.hxx deleted file mode 100644 index 07b5ca3dadf5..000000000000 --- a/vcl/unx/kde4/KDESalDisplay.hxx +++ /dev/null @@ -1,45 +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 - -#include - -class SalKDEDisplay : public SalX11Display -{ - Atom xim_protocol; - static SalKDEDisplay* selfptr; - -protected: - virtual void TriggerUserEventProcessing() override; - -public: - explicit SalKDEDisplay( Display* pDisp ); - virtual ~SalKDEDisplay() override; - static SalKDEDisplay* self(); - virtual void Yield() override; - bool checkDirectInputEvent( XEvent* ev ); -}; - -inline SalKDEDisplay* SalKDEDisplay::self() -{ - return selfptr; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx deleted file mode 100644 index c92551fe6ca2..000000000000 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ /dev/null @@ -1,373 +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 -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#undef Region - -#include "KDESalFrame.hxx" -#include "KDEXLib.hxx" -#include "KDESalGraphics.hxx" - -#include - -#include -#include -#include - -#include - -#include - -#include - - -KDESalFrame::KDESalFrame( SalFrame* pParent, SalFrameStyleFlags nState ) : - X11SalFrame( pParent, nState ) -{ -} - -void KDESalFrame::Show( bool bVisible, bool bNoActivate ) -{ - if ( !GetParent() && ! (GetStyle() & SalFrameStyleFlags::INTRO) ) - { - KDEXLib* pXLib = static_cast(GetDisplay()->GetXLib()); - pXLib->doStartup(); - } - - X11SalFrame::Show( bVisible, bNoActivate ); -} - -/** Helper function to convert colors. -*/ -static Color toColor( const QColor &rColor ) -{ - return Color( rColor.red(), rColor.green(), rColor.blue() ); -} - -/** Helper function to read untranslated text entry from KConfig configuration repository. -*/ -static OUString readEntryUntranslated( - KConfigGroup const*const pGroup, char const*const pKey) -{ - return OUString::createFromAscii( static_cast(pGroup->readEntryUntranslated( pKey ).toAscii()) ); -} - -/** Helper function to add information to Font from QFont. - - Mostly grabbed from the Gtk+ vclplug (salnativewidgets-gtk.cxx). -*/ -static vcl::Font toFont( const QFont &rQFont, const css::lang::Locale& rLocale ) -{ - psp::FastPrintFontInfo aInfo; - QFontInfo qFontInfo( rQFont ); - - // set family name - aInfo.m_aFamilyName = OUString( static_cast(rQFont.family().toUtf8()), strlen( static_cast(rQFont.family().toUtf8()) ), RTL_TEXTENCODING_UTF8 ); - - // set italic - aInfo.m_eItalic = ( qFontInfo.italic()? ITALIC_NORMAL: ITALIC_NONE ); - - // set weight - int nWeight = qFontInfo.weight(); - if ( nWeight <= QFont::Light ) - aInfo.m_eWeight = WEIGHT_LIGHT; - else if ( nWeight <= QFont::Normal ) - aInfo.m_eWeight = WEIGHT_NORMAL; - else if ( nWeight <= QFont::DemiBold ) - aInfo.m_eWeight = WEIGHT_SEMIBOLD; - else if ( nWeight <= QFont::Bold ) - aInfo.m_eWeight = WEIGHT_BOLD; - else - aInfo.m_eWeight = WEIGHT_ULTRABOLD; - - // set width - int nStretch = rQFont.stretch(); - if ( nStretch <= QFont::UltraCondensed ) - aInfo.m_eWidth = WIDTH_ULTRA_CONDENSED; - else if ( nStretch <= QFont::ExtraCondensed ) - aInfo.m_eWidth = WIDTH_EXTRA_CONDENSED; - else if ( nStretch <= QFont::Condensed ) - aInfo.m_eWidth = WIDTH_CONDENSED; - else if ( nStretch <= QFont::SemiCondensed ) - aInfo.m_eWidth = WIDTH_SEMI_CONDENSED; - else if ( nStretch <= QFont::Unstretched ) - aInfo.m_eWidth = WIDTH_NORMAL; - else if ( nStretch <= QFont::SemiExpanded ) - aInfo.m_eWidth = WIDTH_SEMI_EXPANDED; - else if ( nStretch <= QFont::Expanded ) - aInfo.m_eWidth = WIDTH_EXPANDED; - else if ( nStretch <= QFont::ExtraExpanded ) - aInfo.m_eWidth = WIDTH_EXTRA_EXPANDED; - else - aInfo.m_eWidth = WIDTH_ULTRA_EXPANDED; - - SAL_INFO( "vcl.kde4", "font name BEFORE system match: \"" << aInfo.m_aFamilyName << "\"" ); - - // match font to e.g. resolve "Sans" - psp::PrintFontManager::get().matchFont( aInfo, rLocale ); - - SAL_INFO( "vcl.kde4", "font match " << - (aInfo.m_nID != 0 ? "succeeded" : "failed") << - ", name AFTER: \"" << aInfo.m_aFamilyName << "\"" ); - - // font height - int nPointHeight = qFontInfo.pointSize(); - if ( nPointHeight <= 0 ) - nPointHeight = rQFont.pointSize(); - - // Create the font - vcl::Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) ); - if( aInfo.m_eWeight != WEIGHT_DONTKNOW ) - aFont.SetWeight( aInfo.m_eWeight ); - if( aInfo.m_eWidth != WIDTH_DONTKNOW ) - aFont.SetWidthType( aInfo.m_eWidth ); - if( aInfo.m_eItalic != ITALIC_DONTKNOW ) - aFont.SetItalic( aInfo.m_eItalic ); - if( aInfo.m_ePitch != PITCH_DONTKNOW ) - aFont.SetPitch( aInfo.m_ePitch ); - - return aFont; -} - -/** Implementation of KDE integration's main method. -*/ -void KDESalFrame::UpdateSettings( AllSettings& rSettings ) -{ - StyleSettings style( rSettings.GetStyleSettings() ); - bool bSetTitleFont = false; - - // General settings - QPalette pal = QApplication::palette(); - - style.SetToolbarIconSize( ToolbarIconSize::Large ); - - // Font - vcl::Font aFont = toFont( QApplication::font(), rSettings.GetUILanguageTag().getLocale() ); - style.BatchSetFonts( aFont, aFont ); - - aFont.SetWeight( WEIGHT_BOLD ); - if( !bSetTitleFont ) - { - style.SetTitleFont( aFont ); - } - style.SetFloatTitleFont( aFont ); - - style.SetHelpFont( toFont( QToolTip::font(), rSettings.GetUILanguageTag().getLocale())); - - // WM settings - KConfig *pConfig = KGlobal::config().data(); - if ( pConfig ) - { - const char *pKey; - - { - KConfigGroup aWMGroup = pConfig->group( "WM" ); - - pKey = "titleFont"; - if (aWMGroup.hasKey(pKey)) - { - vcl::Font aTitleFont = toFont(aWMGroup.readEntry(pKey, QFont()), - rSettings.GetUILanguageTag().getLocale()); - style.SetTitleFont( aTitleFont ); - bSetTitleFont = true; - } - } - - KConfigGroup aIconsGroup = pConfig->group("Icons"); - - pKey = "Theme"; - if (aIconsGroup.hasKey(pKey)) - style.SetPreferredIconTheme( readEntryUntranslated(&aIconsGroup, pKey)); - - //toolbar - pKey = "toolbarFont"; - if (aIconsGroup.hasKey(pKey)) - { - vcl::Font aToolFont = toFont(aIconsGroup.readEntry(pKey, QFont()), - rSettings.GetUILanguageTag().getLocale()); - style.SetToolFont( aToolFont ); - } - } - - // Menu - std::unique_ptr pMenuBar = std::unique_ptr( new KMenuBar() ); - QPalette qMenuCG = pMenuBar->palette(); - - Color aFore = toColor( pal.color( QPalette::Active, QPalette::WindowText ) ); - Color aBack = toColor( pal.color( QPalette::Active, QPalette::Window ) ); - Color aText = toColor( pal.color( QPalette::Active, QPalette::Text ) ); - Color aBase = toColor( pal.color( QPalette::Active, QPalette::Base ) ); - Color aButn = toColor( pal.color( QPalette::Active, QPalette::ButtonText ) ); - Color aMid = toColor( pal.color( QPalette::Active, QPalette::Mid ) ); - Color aHigh = toColor( pal.color( QPalette::Active, QPalette::Highlight ) ); - Color aHighText = toColor( pal.color( QPalette::Active, QPalette::HighlightedText ) ); - - style.SetSkipDisabledInMenus( TRUE ); - - // Foreground - style.SetRadioCheckTextColor( aFore ); - style.SetLabelTextColor( aFore ); - style.SetDialogTextColor( aFore ); - style.SetGroupTextColor( aFore ); - - // Text - style.SetFieldTextColor( aText ); - style.SetFieldRolloverTextColor( aText ); - style.SetWindowTextColor( aText ); - style.SetToolTextColor( aText ); - - // Base - style.SetFieldColor( aBase ); - style.SetWindowColor( aBase ); - style.SetActiveTabColor( aBase ); - - // Buttons - style.SetButtonTextColor( aButn ); - style.SetButtonRolloverTextColor( aButn ); - style.SetButtonPressedRolloverTextColor( aButn ); - - // Tabs - style.SetTabTextColor( aButn ); - style.SetTabRolloverTextColor( aButn ); - style.SetTabHighlightTextColor( aButn ); - - // Disable color - style.SetDisableColor( toColor( pal.color( QPalette::Disabled, QPalette::WindowText ) ) ); - - // Background - style.BatchSetBackgrounds( aBack ); - style.SetInactiveTabColor( aBack ); - - // Workspace - style.SetWorkspaceColor( aMid ); - - // Selection - style.SetHighlightColor( aHigh ); - style.SetHighlightTextColor( aHighText ); - - // Tooltip - style.SetHelpColor( toColor( QToolTip::palette().color( QPalette::Active, QPalette::ToolTipBase ))); - style.SetHelpTextColor( toColor( QToolTip::palette().color( QPalette::Active, QPalette::ToolTipText ))); - - int flash_time = QApplication::cursorFlashTime(); - style.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME ); - - // Menu text and background color, theme specific - Color aMenuFore = toColor( qMenuCG.color( QPalette::WindowText ) ); - Color aMenuBack = toColor( qMenuCG.color( QPalette::Window ) ); - - style.SetMenuTextColor( aMenuFore ); - style.SetMenuBarTextColor( style.GetPersonaMenuBarTextColor().get_value_or( aMenuFore ) ); - style.SetMenuColor( aMenuBack ); - style.SetMenuBarColor( aMenuBack ); - style.SetMenuHighlightColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) ); - style.SetMenuHighlightTextColor( toColor ( qMenuCG.color( QPalette::HighlightedText ) ) ); - - // set special menubar highlight text color - if ( QApplication::style()->inherits( "HighContrastStyle" ) ) - ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = toColor( qMenuCG.color( QPalette::HighlightedText ) ); - else - ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore; - - // set menubar rollover color - if ( pMenuBar->style()->styleHint( QStyle::SH_MenuBar_MouseTracking ) ) - { - style.SetMenuBarRolloverColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) ); - style.SetMenuBarRolloverTextColor( ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor ); - } - else - { - style.SetMenuBarRolloverColor( aMenuBack ); - style.SetMenuBarRolloverTextColor( aMenuFore ); - } - style.SetMenuBarHighlightTextColor(style.GetMenuHighlightTextColor()); - - // Font - aFont = toFont( pMenuBar->font(), rSettings.GetUILanguageTag().getLocale() ); - style.SetMenuFont( aFont ); - - // Scroll bar size - style.SetScrollBarSize( QApplication::style()->pixelMetric( QStyle::PM_ScrollBarExtent ) ); - style.SetMinThumbSize( QApplication::style()->pixelMetric( QStyle::PM_ScrollBarSliderMin )); - - // These colors are used for the ruler text and marks - style.SetShadowColor(toColor(pal.color(QPalette::Disabled, QPalette::WindowText))); - style.SetDarkShadowColor(toColor(pal.color(QPalette::Inactive, QPalette::WindowText))); - - rSettings.SetStyleSettings( style ); -} - -void KDESalFrame::ReleaseGraphics( SalGraphics *pGraphics ) -{ - for( int i = 0; i < nMaxGraphics; i++ ) - { - if( m_aGraphics[i].pGraphics.get() == pGraphics ) - { - m_aGraphics[i].bInUse = false; - break; - } - } -} - -void KDESalFrame::updateGraphics( bool bClear ) -{ - Drawable aDrawable = bClear ? None : GetWindow(); - for( int i = 0; i < nMaxGraphics; i++ ) - { - if( m_aGraphics[i].bInUse ) - m_aGraphics[i].pGraphics->SetDrawable( aDrawable, GetScreenNumber() ); - } -} - -SalGraphics* KDESalFrame::AcquireGraphics() -{ - if( GetWindow() ) - { - for( int i = 0; i < nMaxGraphics; i++ ) - { - if( ! m_aGraphics[i].bInUse ) - { - m_aGraphics[i].bInUse = true; - if( ! m_aGraphics[i].pGraphics ) - { - m_aGraphics[i].pGraphics.reset( new KDESalGraphics ); - m_aGraphics[i].pGraphics->Init( this, GetWindow(), GetScreenNumber() ); - } - return m_aGraphics[i].pGraphics.get(); - } - } - } - - return nullptr; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDESalFrame.hxx b/vcl/unx/kde4/KDESalFrame.hxx deleted file mode 100644 index 114cd49bd8d2..000000000000 --- a/vcl/unx/kde4/KDESalFrame.hxx +++ /dev/null @@ -1,53 +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 - -#include - -#include -#include -#include - -class KDESalFrame : public X11SalFrame -{ - private: - static const int nMaxGraphics = 2; - - struct GraphicsHolder - { - std::unique_ptr pGraphics; - bool bInUse; - - GraphicsHolder() : bInUse( false ) {} - }; - - GraphicsHolder m_aGraphics[ nMaxGraphics ]; - - public: - KDESalFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ); - - virtual SalGraphics* AcquireGraphics() override; - virtual void ReleaseGraphics( SalGraphics *pGraphics ) override; - virtual void updateGraphics( bool bClear ) override; - virtual void UpdateSettings( AllSettings& rSettings ) override; - virtual void Show( bool bVisible, bool bNoActivate = false ) override; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx deleted file mode 100644 index b36e8abd4762..000000000000 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ /dev/null @@ -1,1025 +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 -#include -#include -#include -#include - -#include -#include - -#undef Region - -#include "KDESalGraphics.hxx" -#include "KDESalInstance.hxx" - -#include -#include -#include - -/** - Conversion function between VCL ControlState together with - ImplControlValue and Qt state flags. - @param nControlState State of the widget (default, focused, ...) in Native Widget Framework. - @param aValue Value held by the widget (on, off, ...) -*/ -static QStyle::State vclStateValue2StateFlag( ControlState nControlState, - const ImplControlValue& aValue ) -{ - QStyle::State nState = - ( (nControlState & ControlState::ENABLED)? QStyle::State_Enabled: QStyle::State_None ) | - ( (nControlState & ControlState::FOCUSED)? QStyle::State_HasFocus: QStyle::State_None ) | - ( (nControlState & ControlState::PRESSED)? QStyle::State_Sunken: QStyle::State_None ) | - ( (nControlState & ControlState::SELECTED)? QStyle::State_Selected : QStyle::State_None ) | - ( (nControlState & ControlState::ROLLOVER)? QStyle::State_MouseOver: QStyle::State_None ); - - switch ( aValue.getTristateVal() ) - { - case ButtonValue::On: nState |= QStyle::State_On; break; - case ButtonValue::Off: nState |= QStyle::State_Off; break; - case ButtonValue::Mixed: nState |= QStyle::State_NoChange; break; - default: break; - } - - return nState; -} - -/** - Convert tools::Rectangle to QRect. - @param rControlRegion The tools::Rectangle to convert. - @return The matching QRect -*/ -static QRect region2QRect( const tools::Rectangle& rControlRegion ) -{ - return QRect(rControlRegion.Left(), rControlRegion.Top(), rControlRegion.GetWidth(), rControlRegion.GetHeight()); -} - -bool KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart part ) -{ - switch (type) - { - case ControlType::Pushbutton: - case ControlType::Radiobutton: - case ControlType::Checkbox: - case ControlType::Tooltip: - case ControlType::Progress: - case ControlType::ListNode: - return (part == ControlPart::Entire); - - case ControlType::Menubar: - case ControlType::MenuPopup: - case ControlType::Editbox: - case ControlType::MultilineEditbox: - case ControlType::Combobox: - case ControlType::Toolbar: - case ControlType::Frame: - case ControlType::Scrollbar: - case ControlType::WindowBackground: - case ControlType::Fixedline: - return true; - - case ControlType::Listbox: - return (part == ControlPart::Entire || part == ControlPart::HasBackgroundTexture); - - case ControlType::Spinbox: - return (part == ControlPart::Entire || part == ControlPart::HasBackgroundTexture); - - case ControlType::Slider: - return (part == ControlPart::TrackHorzArea || part == ControlPart::TrackVertArea); - - default: - break; - } - - return false; -} - -/// helper drawing methods -namespace -{ - void draw( QStyle::ControlElement element, QStyleOption* option, QImage* image, QStyle::State const & state, QRect rect = QRect()) - { - option->state |= state; - option->rect = !rect.isNull() ? rect : image->rect(); - - QPainter painter(image); - QApplication::style()->drawControl(element, option, &painter); - } - - void draw( QStyle::PrimitiveElement element, QStyleOption* option, QImage* image, QStyle::State const & state, QRect rect = QRect()) - { - option->state |= state; - option->rect = !rect.isNull() ? rect : image->rect(); - - QPainter painter(image); - QApplication::style()->drawPrimitive(element, option, &painter); - } - - void draw( QStyle::ComplexControl element, QStyleOptionComplex* option, QImage* image, QStyle::State const & state ) - { - option->state |= state; - option->rect = image->rect(); - - QPainter painter(image); - QApplication::style()->drawComplexControl(element, option, &painter); - } - - void lcl_drawFrame( QStyle::PrimitiveElement element, QImage* image, QStyle::State const & state, - QStyle::PixelMetric eLineMetric = QStyle::PM_DefaultFrameWidth ) - { - #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) - QStyleOptionFrameV3 option; - option.frameShape = QFrame::StyledPanel; - option.state = QStyle::State_Sunken; - option.lineWidth = QApplication::style()->pixelMetric( eLineMetric ); - #else - QStyleOptionFrame option; - - QFrame aFrame( nullptr ); - aFrame.setFrameRect( QRect(0, 0, image->width(), image->height()) ); - aFrame.setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); - aFrame.ensurePolished(); - - option.initFrom( &aFrame ); - option.lineWidth = aFrame.lineWidth(); - option.midLineWidth = aFrame.midLineWidth(); - #endif - draw(element, &option, image, state); - } -} - -#if QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) -#define IMAGE_BASED_PAINTING -#else -#undef IMAGE_BASED_PAINTING -#endif - -#ifdef IMAGE_BASED_PAINTING -// There is a small catch with this function, although hopefully only philosophical. -// Officially Xlib's vcl::Region is an opaque data type, with only functions for manipulating it. -// However, whoever designed it apparently didn't give it that much thought, as it's impossible -// to find out what exactly a region actually is (except for really weird ways like XClipBox() -// and repeated XPointInRegion(), which would be awfully slow). Fortunately, the header file -// describing the structure actually happens to be installed too, and there's at least one -// widely used software using it (Compiz). So access the data directly too and assume that -// everybody who compiles with Qt4 support has Xlib new enough and good enough to support this. -// In case this doesn't work for somebody, try #include instead, or build -// without IMAGE_BASED_PAINTING (in which case QApplication::setGraphicsSystem( "native" ) may -// be needed too). -#include -static QRegion XRegionToQRegion( Region xr ) -{ - QRegion qr; - for( long i = 0; - i < xr->numRects; - ++i ) - { - BOX& b = xr->rects[ i ]; - qr |= QRect( b.x1, b.y1, b.x2 - b.x1, b.y2 - b.y1 ); // x2,y2 is outside, not the bottom-right corner - } - return qr; -} -#endif - -bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, - const tools::Rectangle& rControlRegion, ControlState nControlState, - const ImplControlValue& value, - const OUString& ) -{ - bool nativeSupport = IsNativeControlSupported( type, part ); - if( ! nativeSupport ) { - assert( ! nativeSupport && "drawNativeControl called without native support!" ); - return false; - } - - if( lastPopupRect.isValid() && ( type != ControlType::MenuPopup || part != ControlPart::MenuItem )) - lastPopupRect = QRect(); - - bool returnVal = true; - - QRect widgetRect = region2QRect(rControlRegion); - - //if no image, or resized, make a new image - if (!m_image || m_image->size() != widgetRect.size()) - { - m_image.reset(new QImage( widgetRect.width(), widgetRect.height(), QImage::Format_ARGB32 ) ); - } - - // Default image color - just once - switch (type) - { - case ControlType::MenuPopup: - if( part == ControlPart::MenuItemCheckMark || part == ControlPart::MenuItemRadioMark ) - { - // it is necessary to fill the background transparently first, as this - // is painted after menuitem highlight, otherwise there would be a grey area - m_image->fill( Qt::transparent ); - break; - } - [[fallthrough]]; // QPalette::Window - case ControlType::Menubar: - case ControlType::WindowBackground: - m_image->fill( KApplication::palette().color(QPalette::Window).rgb() ); - break; - case ControlType::Tooltip: - m_image->fill(KApplication::palette().color(QPalette::ToolTipBase).rgb()); - break; - case ControlType::Pushbutton: - m_image->fill(KApplication::palette().color(QPalette::Button).rgb()); - break; - case ControlType::Scrollbar: - if ((part == ControlPart::DrawBackgroundVert) - || (part == ControlPart::DrawBackgroundHorz)) - { - m_image->fill( KApplication::palette().color(QPalette::Window).rgb() ); - break; - } - [[fallthrough]]; // Qt::transparent - default: - m_image->fill( Qt::transparent ); - break; - } - - QRegion* localClipRegion = nullptr; - - if (type == ControlType::Pushbutton) - { - QStyleOptionButton option; - draw( QStyle::CE_PushButton, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - } - else if (type == ControlType::Menubar) - { - if (part == ControlPart::MenuItem) - { - QStyleOptionMenuItem option; - if ( ( nControlState & ControlState::ROLLOVER ) - && QApplication::style()->styleHint( QStyle::SH_MenuBar_MouseTracking ) ) - option.state |= QStyle::State_Selected; - - if ( nControlState & ControlState::SELECTED ) // Passing State_Sunken is currently not documented. - option.state |= QStyle::State_Sunken; // But some kinds of QStyle interpret it. - - draw( QStyle::CE_MenuBarItem, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - } - else if (part == ControlPart::Entire) - { - QStyleOptionMenuItem option; - draw( QStyle::CE_MenuBarEmptyArea, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - } - else - { - returnVal = false; - } - } - else if (type == ControlType::MenuPopup) - { - OSL_ASSERT( part == ControlPart::MenuItem ? lastPopupRect.isValid() : !lastPopupRect.isValid()); - if( part == ControlPart::MenuItem ) - { - QStyleOptionMenuItem option; - draw( QStyle::CE_MenuItem, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - // HACK: LO core first paints the entire popup and only then it paints menu items, - // but QMenu::paintEvent() paints popup frame after all items. That means highlighted - // items here would paint the highlight over the frame border. Since calls to ControlPart::MenuItem - // are always preceded by calls to ControlPart::Entire, just remember the size for the whole - // popup (otherwise not possible to get here) and draw the border afterwards. - QRect framerect( lastPopupRect.topLeft() - widgetRect.topLeft(), - widgetRect.size().expandedTo( lastPopupRect.size())); - QStyleOptionFrame frame; - draw( QStyle::PE_FrameMenu, &frame, m_image.get(), vclStateValue2StateFlag( nControlState, value ), framerect ); - } - else if( part == ControlPart::Separator ) - { - QStyleOptionMenuItem option; - option.menuItemType = QStyleOptionMenuItem::Separator; - // Painting the whole menu item area results in different background - // with at least Plastique style, so clip only to the separator itself - // (QSize( 2, 2 ) is hardcoded in Qt) - option.rect = m_image->rect(); - QSize size = QApplication::style()->sizeFromContents( QStyle::CT_MenuItem, &option, QSize( 2, 2 )); - QRect rect = m_image->rect(); - QPoint center = rect.center(); - rect.setHeight( size.height()); - rect.moveCenter( center ); - // don't paint over popup frame border (like the hack above, but here it can be simpler) - int fw = QApplication::style()->pixelMetric( QStyle::PM_MenuPanelWidth ); - localClipRegion = new QRegion(rect.translated(widgetRect.topLeft()).adjusted(fw, 0, -fw, 0)); - draw( QStyle::CE_MenuItem, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value), rect ); - } - else if( part == ControlPart::MenuItemCheckMark || part == ControlPart::MenuItemRadioMark ) - { - QStyleOptionMenuItem option; - option.checkType = ( part == ControlPart::MenuItemCheckMark ) - ? QStyleOptionMenuItem::NonExclusive : QStyleOptionMenuItem::Exclusive; - option.checked = bool( nControlState & ControlState::PRESSED ); - // widgetRect is now the rectangle for the checkbox/radiobutton itself, but Qt - // paints the whole menu item, so translate position (and it'll be clipped); - // it is also necessary to fill the background transparently first, as this - // is painted after menuitem highlight, otherwise there would be a grey area - assert( value.getType() == ControlType::MenuPopup ); - const MenupopupValue* menuVal = static_cast(&value); - QRect menuItemRect( region2QRect( menuVal->maItemRect )); - QRect rect( menuItemRect.topLeft() - widgetRect.topLeft(), - widgetRect.size().expandedTo( menuItemRect.size())); - // checkboxes are always displayed next to images in menus, so are never centered - const int focus_size = QApplication::style()->pixelMetric( QStyle::PM_FocusFrameHMargin ); - rect.moveTo( -focus_size, rect.y() ); - draw( QStyle::CE_MenuItem, &option, m_image.get(), - vclStateValue2StateFlag(nControlState & ~ControlState::PRESSED, value), rect ); - } - else if( part == ControlPart::Entire ) - { - QStyleOptionMenuItem option; - draw( QStyle::PE_PanelMenu, &option, m_image.get(), vclStateValue2StateFlag( nControlState, value )); - // Try hard to get any frame! - QStyleOptionFrame frame; - draw( QStyle::PE_FrameMenu, &frame, m_image.get(), vclStateValue2StateFlag( nControlState, value )); - draw( QStyle::PE_FrameWindow, &frame, m_image.get(), vclStateValue2StateFlag( nControlState, value )); - lastPopupRect = widgetRect; - } - else - returnVal = false; - } - else if ( (type == ControlType::Toolbar) && (part == ControlPart::Button) ) - { - QStyleOptionToolButton option; - - option.arrowType = Qt::NoArrow; - option.subControls = QStyle::SC_ToolButton; - - option.state = vclStateValue2StateFlag( nControlState, value ); - option.state |= QStyle::State_Raised | QStyle::State_Enabled | QStyle::State_AutoRaise; - - draw( QStyle::CC_ToolButton, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - } - else if ( (type == ControlType::Toolbar) && (part == ControlPart::Entire) ) - { - QStyleOptionToolBar option; - - option.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - option.state = vclStateValue2StateFlag( nControlState, value ); - - draw( QStyle::CE_ToolBar, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - } - else if ( (type == ControlType::Toolbar) - && (part == ControlPart::ThumbVert || part == ControlPart::ThumbHorz) ) - { // reduce paint area only to the handle area - const int handleExtend = QApplication::style()->pixelMetric(QStyle::PM_ToolBarHandleExtent); - QRect rect; - QStyleOption option; - - if (part == ControlPart::ThumbVert) - { - rect = QRect( 0, 0, handleExtend, widgetRect.height()); - localClipRegion = new QRegion(widgetRect.x(), widgetRect.y(), handleExtend, widgetRect.height()); - option.state = QStyle::State_Horizontal; - } - else - { - rect = QRect( 0, 0, widgetRect.width(), handleExtend); - localClipRegion = new QRegion(widgetRect.x(), widgetRect.y(), widgetRect.width(), handleExtend); - } - - draw( QStyle::PE_IndicatorToolBarHandle, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value), rect ); - } - else if (type == ControlType::Editbox) - { - lcl_drawFrame( QStyle::PE_PanelLineEdit, m_image.get(), - vclStateValue2StateFlag(nControlState, value)); - } - else if (type == ControlType::MultilineEditbox) - { - lcl_drawFrame( QStyle::PE_FrameLineEdit, m_image.get(), - vclStateValue2StateFlag(nControlState, value)); - } - else if (type == ControlType::Combobox) - { - QStyleOptionComboBox option; - option.editable = true; - draw( QStyle::CC_ComboBox, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - } - else if (type == ControlType::Listbox) - { - QStyleOptionComboBox option; - option.editable = false; - switch (part) { - case ControlPart::ListboxWindow: - lcl_drawFrame( QStyle::PE_Frame, m_image.get(), - vclStateValue2StateFlag(nControlState, value), - QStyle::PM_ComboBoxFrameWidth ); - break; - case ControlPart::SubEdit: - draw( QStyle::CE_ComboBoxLabel, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - break; - case ControlPart::Entire: - draw( QStyle::CC_ComboBox, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - break; - case ControlPart::ButtonDown: - option.subControls = QStyle::SC_ComboBoxArrow; - draw( QStyle::CC_ComboBox, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - break; - default: - returnVal = false; - break; - } - } - else if (type == ControlType::ListNode) - { - QStyleOption option; - option.state = QStyle::State_Item | QStyle::State_Children; - - if (value.getTristateVal() == ButtonValue::On) - option.state |= QStyle::State_Open; - - draw( QStyle::PE_IndicatorBranch, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - } - else if (type == ControlType::Checkbox) - { - QStyleOptionButton option; - draw( QStyle::CE_CheckBox, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - } - else if (type == ControlType::Scrollbar) - { - if ((part == ControlPart::DrawBackgroundVert) || (part == ControlPart::DrawBackgroundHorz)) - { - QStyleOptionSlider option; - OSL_ASSERT( value.getType() == ControlType::Scrollbar ); - const ScrollbarValue* sbVal = static_cast(&value); - - //if the scroll bar is active (aka not degenerate... allow for hover events) - if (sbVal->mnVisibleSize < sbVal->mnMax) - option.state = QStyle::State_MouseOver; - - bool horizontal = ( part == ControlPart::DrawBackgroundHorz ); //horizontal or vertical - option.orientation = horizontal ? Qt::Horizontal : Qt::Vertical; - if( horizontal ) - option.state |= QStyle::State_Horizontal; - - //setup parameters from the OO values - option.minimum = sbVal->mnMin; - option.maximum = sbVal->mnMax - sbVal->mnVisibleSize; - option.maximum = qMax( option.maximum, option.minimum ); // bnc#619772 - option.sliderValue = sbVal->mnCur; - option.sliderPosition = sbVal->mnCur; - option.pageStep = sbVal->mnVisibleSize; - if (part == ControlPart::DrawBackgroundHorz) - option.upsideDown = sbVal->maButton1Rect.Left() > sbVal->maButton2Rect.Left(); - - //setup the active control... always the slider - if (sbVal->mnThumbState & ControlState::ROLLOVER) - option.activeSubControls = QStyle::SC_ScrollBarSlider; - - draw( QStyle::CC_ScrollBar, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - } - else - { - returnVal = false; - } - } - else if (type == ControlType::Spinbox) - { - QStyleOptionSpinBox option; - option.frame = true; - - // determine active control - if( value.getType() == ControlType::SpinButtons ) - { - const SpinbuttonValue* pSpinVal = static_cast(&value); - if( pSpinVal->mnUpperState & ControlState::PRESSED ) - option.activeSubControls |= QStyle::SC_SpinBoxUp; - if( pSpinVal->mnLowerState & ControlState::PRESSED ) - option.activeSubControls |= QStyle::SC_SpinBoxDown; - if( pSpinVal->mnUpperState & ControlState::ENABLED ) - option.stepEnabled |= QAbstractSpinBox::StepUpEnabled; - if( pSpinVal->mnLowerState & ControlState::ENABLED ) - option.stepEnabled |= QAbstractSpinBox::StepDownEnabled; - if( pSpinVal->mnUpperState & ControlState::ROLLOVER ) - option.state = QStyle::State_MouseOver; - if( pSpinVal->mnLowerState & ControlState::ROLLOVER ) - option.state = QStyle::State_MouseOver; - } - - draw( QStyle::CC_SpinBox, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - } - else if (type == ControlType::Radiobutton) - { - QStyleOptionButton option; - draw( QStyle::CE_RadioButton, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - } - else if (type == ControlType::Tooltip) - { - QStyleOption option; - draw( QStyle::PE_PanelTipLabel, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - } - else if (type == ControlType::Frame) - { - lcl_drawFrame( QStyle::PE_Frame, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - // draw just the border, see http://qa.openoffice.org/issues/show_bug.cgi?id=107945 - int fw = QApplication::style()->pixelMetric(QStyle::PM_DefaultFrameWidth); - localClipRegion = new QRegion(QRegion(widgetRect).subtracted(widgetRect.adjusted(fw, fw, -fw, -fw))); - } - else if (type == ControlType::WindowBackground) - { - // Nothing to do - see "Default image color" switch ^^ - } - else if (type == ControlType::Fixedline) - { - QStyleOptionMenuItem option; - option.menuItemType = QStyleOptionMenuItem::Separator; - option.state |= QStyle::State_Item; - - draw( QStyle::CE_MenuItem, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - } - else if (type == ControlType::Slider && (part == ControlPart::TrackHorzArea || part == ControlPart::TrackVertArea)) - { - OSL_ASSERT( value.getType() == ControlType::Slider ); - const SliderValue* slVal = static_cast(&value); - QStyleOptionSlider option; - - option.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - option.state = vclStateValue2StateFlag( nControlState, value ); - option.maximum = slVal->mnMax; - option.minimum = slVal->mnMin; - option.sliderPosition = option.sliderValue = slVal->mnCur; - bool horizontal = ( part == ControlPart::TrackHorzArea ); //horizontal or vertical - option.orientation = horizontal ? Qt::Horizontal : Qt::Vertical; - if( horizontal ) - option.state |= QStyle::State_Horizontal; - - draw( QStyle::CC_Slider, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); - } - else if( type == ControlType::Progress && part == ControlPart::Entire ) - { - QStyleOptionProgressBarV2 option; - option.minimum = 0; - option.maximum = widgetRect.width(); - option.progress = value.getNumericVal(); - option.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - option.state = vclStateValue2StateFlag( nControlState, value ); - - draw( QStyle::CE_ProgressBar, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value) ); - } - else - { - returnVal = false; - } - - if (returnVal) - { -#ifdef IMAGE_BASED_PAINTING - // Create a wrapper QPixmap around the destination pixmap, allowing the use of QPainter. - // Using X11SalGraphics::CopyScreenArea() would require using QPixmap and if Qt uses - // other graphics system than native, QPixmap::handle() would be 0 (i.e. it wouldn't work), - // I have no idea how to create QPixmap with non-null handle() in such case, so go this way. - // See XRegionToQRegion() comment for a small catch (although not real hopefully). - QPixmap destPixmap = QPixmap::fromX11Pixmap( GetDrawable(), QPixmap::ExplicitlyShared ); - QPainter paint( &destPixmap ); - if (localClipRegion && mpClipRegion) - paint.setClipRegion(localClipRegion->intersected(XRegionToQRegion(mpClipRegion))); - else if (localClipRegion) - paint.setClipRegion(*localClipRegion); - else if( mpClipRegion ) - paint.setClipRegion( XRegionToQRegion( mpClipRegion )); - paint.drawImage( widgetRect.left(), widgetRect.top(), *m_image, - 0, 0, widgetRect.width(), widgetRect.height(), - Qt::ColorOnly | Qt::OrderedDither | Qt::OrderedAlphaDither ); -#else - GC gc = GetFontGC(); - if( gc ) - { - Region pTempClipRegion = NULL; - if (localClipRegion) - { - pTempClipRegion = XCreateRegion(); - foreach(const QRect& r, localClipRegion->rects()) - { - XRectangle xr; - xr.x = r.x(); - xr.y = r.y(); - xr.width = r.width(); - xr.height = r.height(); - XUnionRectWithRegion( &xr, pTempClipRegion, pTempClipRegion ); - } - if( mpClipRegion ) - XIntersectRegion( pTempClipRegion, mpClipRegion, pTempClipRegion ); - XSetRegion( GetXDisplay(), gc, pTempClipRegion ); - } - QPixmap pixmap = QPixmap::fromImage(*m_image, Qt::ColorOnly | Qt::OrderedDither | Qt::OrderedAlphaDither); - X11SalGraphics::CopyScreenArea( GetXDisplay(), - pixmap.handle(), pixmap.x11Info().screen(), pixmap.x11Info().depth(), - GetDrawable(), GetScreenNumber(), GetVisual().GetDepth(), - gc, 0, 0, widgetRect.width(), widgetRect.height(), widgetRect.left(), widgetRect.top()); - - if( pTempClipRegion ) - { - if( mpClipRegion ) - XSetRegion( GetXDisplay(), gc, mpClipRegion ); - else - XSetClipMask( GetXDisplay(), gc, None ); - XDestroyRegion( pTempClipRegion ); - } - } - else - returnVal = false; -#endif - } - delete localClipRegion; - return returnVal; -} - -bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, - const tools::Rectangle& controlRegion, ControlState controlState, - const ImplControlValue& val, - const OUString&, - tools::Rectangle &nativeBoundingRegion, tools::Rectangle &nativeContentRegion ) -{ - bool retVal = false; - - QRect boundingRect = region2QRect( controlRegion ); - QRect contentRect = boundingRect; - QStyleOptionComplex styleOption; - - switch ( type ) - { - // Metrics of the push button - case ControlType::Pushbutton: - if (part == ControlPart::Entire) - { - styleOption.state = vclStateValue2StateFlag(controlState, val); - - if ( controlState & ControlState::DEFAULT ) - { - int size = QApplication::style()->pixelMetric( - QStyle::PM_ButtonDefaultIndicator, &styleOption ); - boundingRect.adjust( -size, -size, size, size ); - retVal = true; - } - } - break; - case ControlType::Editbox: - case ControlType::MultilineEditbox: - { - QStyleOptionFrameV3 fo; - fo.frameShape = QFrame::StyledPanel; - fo.state = QStyle::State_Sunken; - fo.lineWidth = QApplication::style()->pixelMetric(QStyle::PM_DefaultFrameWidth); - QSize aMinSize = QApplication::style()-> - sizeFromContents( QStyle::CT_LineEdit, &fo, contentRect.size() ); - if( aMinSize.height() > boundingRect.height() ) - { - int nHeight = (aMinSize.height() - boundingRect.height()) / 2; - assert( 0 == (aMinSize.height() - boundingRect.height()) % 2 ); - boundingRect.adjust( 0, -nHeight, 0, nHeight ); - } - if( aMinSize.width() > boundingRect.width() ) - { - int nWidth = (aMinSize.width() - boundingRect.width()) / 2; - assert( 0 == (aMinSize.width() - boundingRect.width()) % 2 ); - boundingRect.adjust( -nWidth, 0, nWidth, 0 ); - } - retVal = true; - break; - } - case ControlType::Checkbox: - if (part == ControlPart::Entire) - { - styleOption.state = vclStateValue2StateFlag(controlState, val); - - contentRect.setWidth(QApplication::style()->pixelMetric( - QStyle::PM_IndicatorWidth, &styleOption)); - contentRect.setHeight(QApplication::style()->pixelMetric( - QStyle::PM_IndicatorHeight, &styleOption)); - - contentRect.adjust(0, 0, - 2 * QApplication::style()->pixelMetric( - QStyle::PM_FocusFrameHMargin, &styleOption), - 2 * QApplication::style()->pixelMetric( - QStyle::PM_FocusFrameVMargin, &styleOption) - ); - - boundingRect = contentRect; - - retVal = true; - } - break; - case ControlType::Combobox: - case ControlType::Listbox: - { - QStyleOptionComboBox cbo; - - cbo.rect = QRect(0, 0, contentRect.width(), contentRect.height()); - cbo.state = vclStateValue2StateFlag(controlState, val); - - switch ( part ) - { - case ControlPart::Entire: - { - // find out the minimum size that should be used - // assume contents is a text ling - int nHeight = QApplication::fontMetrics().height(); - QSize aContentSize( contentRect.width(), nHeight ); - QSize aMinSize = QApplication::style()-> - sizeFromContents( QStyle::CT_ComboBox, &cbo, aContentSize ); - if( aMinSize.height() > contentRect.height() ) - contentRect.adjust( 0, 0, 0, aMinSize.height() - contentRect.height() ); - boundingRect = contentRect; - retVal = true; - break; - } - case ControlPart::ButtonDown: - contentRect = QApplication::style()->subControlRect( - QStyle::CC_ComboBox, &cbo, QStyle::SC_ComboBoxArrow ); - contentRect.translate( boundingRect.left(), boundingRect.top() ); - retVal = true; - break; - case ControlPart::SubEdit: - { - contentRect = QApplication::style()->subControlRect( - QStyle::CC_ComboBox, &cbo, QStyle::SC_ComboBoxEditField ); - contentRect.translate( boundingRect.left(), boundingRect.top() ); - retVal = true; - break; - } - default: - break; - } - break; - } - case ControlType::Spinbox: - { - QStyleOptionSpinBox sbo; - sbo.frame = true; - - sbo.rect = QRect(0, 0, contentRect.width(), contentRect.height()); - sbo.state = vclStateValue2StateFlag(controlState, val); - - switch ( part ) - { - case ControlPart::Entire: - { - int nHeight = QApplication::fontMetrics().height(); - QSize aContentSize( contentRect.width(), nHeight ); - QSize aMinSize = QApplication::style()-> - sizeFromContents( QStyle::CT_SpinBox, &sbo, aContentSize ); - if( aMinSize.height() > contentRect.height() ) - contentRect.adjust( 0, 0, 0, aMinSize.height() - contentRect.height() ); - boundingRect = contentRect; - retVal = true; - break; - } - case ControlPart::ButtonUp: - contentRect = QApplication::style()->subControlRect( - QStyle::CC_SpinBox, &sbo, QStyle::SC_SpinBoxUp ); - contentRect.translate( boundingRect.left(), boundingRect.top() ); - retVal = true; - boundingRect = QRect(); - break; - - case ControlPart::ButtonDown: - contentRect = QApplication::style()->subControlRect( - QStyle::CC_SpinBox, &sbo, QStyle::SC_SpinBoxDown ); - retVal = true; - contentRect.translate( boundingRect.left(), boundingRect.top() ); - boundingRect = QRect(); - break; - - case ControlPart::SubEdit: - contentRect = QApplication::style()->subControlRect( - QStyle::CC_SpinBox, &sbo, QStyle::SC_SpinBoxEditField ); - retVal = true; - contentRect.translate( boundingRect.left(), boundingRect.top() ); - break; - default: - break; - } - break; - } - case ControlType::MenuPopup: - { - int h, w; - switch ( part ) { - case ControlPart::MenuItemCheckMark: - h = QApplication::style()->pixelMetric(QStyle::PM_IndicatorHeight); - w = QApplication::style()->pixelMetric(QStyle::PM_IndicatorWidth); - retVal = true; - break; - case ControlPart::MenuItemRadioMark: - h = QApplication::style()->pixelMetric(QStyle::PM_ExclusiveIndicatorHeight); - w = QApplication::style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth); - retVal = true; - break; - default: - break; - } - if (retVal) { - contentRect = QRect(0, 0, w, h); - boundingRect = contentRect; - } - break; - } - case ControlType::Frame: - { - if( part == ControlPart::Border ) - { - auto nStyle = static_cast( - val.getNumericVal() & 0xFFF0); - if( nStyle & DrawFrameFlags::NoDraw ) - { - int nFrameWidth = QApplication::style()->pixelMetric(QStyle::PM_DefaultFrameWidth); - contentRect.adjust(nFrameWidth, nFrameWidth, -nFrameWidth, -nFrameWidth); - } - retVal = true; - } - break; - } - case ControlType::Radiobutton: - { - const int h = QApplication::style()->pixelMetric(QStyle::PM_ExclusiveIndicatorHeight); - const int w = QApplication::style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth); - - contentRect = QRect(boundingRect.left(), boundingRect.top(), w, h); - contentRect.adjust(0, 0, - 2 * QApplication::style()->pixelMetric( - QStyle::PM_FocusFrameHMargin, &styleOption), - 2 * QApplication::style()->pixelMetric( - QStyle::PM_FocusFrameVMargin, &styleOption) - ); - boundingRect = contentRect; - - retVal = true; - break; - } - case ControlType::Slider: - { - const int w = QApplication::style()->pixelMetric(QStyle::PM_SliderLength); - if( part == ControlPart::ThumbHorz ) - { - contentRect = QRect(boundingRect.left(), boundingRect.top(), w, boundingRect.height()); - boundingRect = contentRect; - retVal = true; - } - else if( part == ControlPart::ThumbVert ) - { - contentRect = QRect(boundingRect.left(), boundingRect.top(), boundingRect.width(), w); - boundingRect = contentRect; - retVal = true; - } - break; - } - case ControlType::Toolbar: - { - const int nWorH = QApplication::style()->pixelMetric(QStyle::PM_ToolBarHandleExtent); - if( part == ControlPart::ThumbHorz ) - { - contentRect = QRect(boundingRect.left(), boundingRect.top(), boundingRect.width(), nWorH ); - boundingRect = contentRect; - retVal = true; - } - else if( part == ControlPart::ThumbVert ) - { - contentRect = QRect(boundingRect.left(), boundingRect.top(), nWorH, boundingRect.height() ); - boundingRect = contentRect; - retVal = true; - } - break; - } - case ControlType::Scrollbar: - { - // core can't handle 3-button scrollbars well, so we fix that in hitTestNativeControl(), - // for the rest also provide the track area (i.e. area not taken by buttons) - if( part == ControlPart::TrackVertArea || part == ControlPart::TrackHorzArea ) - { - QStyleOptionSlider option; - bool horizontal = ( part == ControlPart::TrackHorzArea ); //horizontal or vertical - option.orientation = horizontal ? Qt::Horizontal : Qt::Vertical; - if( horizontal ) - option.state |= QStyle::State_Horizontal; - // getNativeControlRegion usually gets ImplControlValue as 'val' (i.e. not the proper - // subclass), so use random sensible values (doesn't matter anyway, as the wanted - // geometry here depends only on button sizes) - option.maximum = 10; - option.minimum = 0; - option.sliderPosition = option.sliderValue = 4; - option.pageStep = 2; - // Adjust coordinates to make the widget appear to be at (0,0), i.e. make - // widget and screen coordinates the same. QStyle functions should use screen - // coordinates but at least QPlastiqueStyle::subControlRect() is buggy - // and sometimes uses widget coordinates. - QRect rect = contentRect; - rect.moveTo( 0, 0 ); - option.rect = rect; - rect = QApplication::style()->subControlRect( QStyle::CC_ScrollBar, &option, - QStyle::SC_ScrollBarGroove ); - rect.translate( contentRect.topLeft()); // reverse the workaround above - contentRect = boundingRect = rect; - retVal = true; - } - break; - } - default: - break; - } - if (retVal) - { - // Bounding region - Point aBPoint( boundingRect.x(), boundingRect.y() ); - Size aBSize( boundingRect.width(), boundingRect.height() ); - nativeBoundingRegion = tools::Rectangle( aBPoint, aBSize ); - - // vcl::Region of the content - Point aPoint( contentRect.x(), contentRect.y() ); - Size aSize( contentRect.width(), contentRect.height() ); - nativeContentRegion = tools::Rectangle( aPoint, aSize ); - } - - return retVal; -} - -/** Test whether the position is in the native widget. - If the return value is TRUE, bIsInside contains information whether - aPos was or was not inside the native widget specified by the - nType/nPart combination. -*/ -bool KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, - const tools::Rectangle& rControlRegion, const Point& rPos, - bool& rIsInside ) -{ - if ( nType == ControlType::Scrollbar ) - { - if( nPart != ControlPart::ButtonUp && nPart != ControlPart::ButtonDown - && nPart != ControlPart::ButtonLeft && nPart != ControlPart::ButtonRight ) - { // we adjust only for buttons (because some scrollbars have 3 buttons, - // and LO core doesn't handle such scrollbars well) - return FALSE; - } - rIsInside = FALSE; - bool bHorizontal = ( nPart == ControlPart::ButtonLeft || nPart == ControlPart::ButtonRight ); - QRect rect = region2QRect( rControlRegion ); - QPoint pos( rPos.X(), rPos.Y()); - // Adjust coordinates to make the widget appear to be at (0,0), i.e. make - // widget and screen coordinates the same. QStyle functions should use screen - // coordinates but at least QPlastiqueStyle::subControlRect() is buggy - // and sometimes uses widget coordinates. - pos -= rect.topLeft(); - rect.moveTo( 0, 0 ); - QStyleOptionSlider options; - options.orientation = bHorizontal ? Qt::Horizontal : Qt::Vertical; - if( bHorizontal ) - options.state |= QStyle::State_Horizontal; - options.rect = rect; - // some random sensible values, since we call this code only for scrollbar buttons, - // the slider position does not exactly matter - options.maximum = 10; - options.minimum = 0; - options.sliderPosition = options.sliderValue = 4; - options.pageStep = 2; - QStyle::SubControl control = QApplication::style()->hitTestComplexControl( QStyle::CC_ScrollBar, &options, pos ); - if( nPart == ControlPart::ButtonUp || nPart == ControlPart::ButtonLeft ) - rIsInside = ( control == QStyle::SC_ScrollBarSubLine ); - else // DOWN, RIGHT - rIsInside = ( control == QStyle::SC_ScrollBarAddLine ); - return TRUE; - } - return FALSE; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDESalGraphics.hxx b/vcl/unx/kde4/KDESalGraphics.hxx deleted file mode 100644 index eb513388f369..000000000000 --- a/vcl/unx/kde4/KDESalGraphics.hxx +++ /dev/null @@ -1,53 +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 - -#include - -#include -#include -#include - -#include - -/** - * Handles native graphics requests and performs the needed drawing operations. - */ -class KDESalGraphics : public X11SalGraphics -{ -public: - virtual bool IsNativeControlSupported( ControlType, ControlPart ) override; - - virtual bool hitTestNativeControl( ControlType, ControlPart, - const tools::Rectangle&, const Point&, bool& ) override; - - virtual bool drawNativeControl( ControlType, ControlPart, const tools::Rectangle&, - ControlState, const ImplControlValue&, const OUString& ) override; - - virtual bool getNativeControlRegion( ControlType, ControlPart, const tools::Rectangle&, - ControlState, const ImplControlValue&, - const OUString&, tools::Rectangle&, tools::Rectangle& ) override; - -private: - std::unique_ptr m_image; - QRect lastPopupRect; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDESalInstance.cxx b/vcl/unx/kde4/KDESalInstance.cxx deleted file mode 100644 index c11d62689b52..000000000000 --- a/vcl/unx/kde4/KDESalInstance.cxx +++ /dev/null @@ -1,66 +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 "KDE4FilePicker.hxx" -#include "KDESalInstance.hxx" - -#include "KDESalFrame.hxx" - -#include "KDEXLib.hxx" -#include "KDESalDisplay.hxx" - -#include -#include -#include - -using namespace com::sun::star; - -KDESalInstance::KDESalInstance(std::unique_ptr pMutex) - : X11SalInstance(std::move(pMutex)) -{ - ImplSVData* pSVData = ImplGetSVData(); - pSVData->maAppData.mxToolkitName = OUString("kde4"); -} - -SalFrame* KDESalInstance::CreateFrame( SalFrame *pParent, SalFrameStyleFlags nState ) -{ - return new KDESalFrame( pParent, nState ); -} - -uno::Reference< ui::dialogs::XFilePicker2 > KDESalInstance::createFilePicker( - const uno::Reference< uno::XComponentContext >& xMSF ) -{ - KDEXLib* kdeXLib = static_cast( mpXLib ); - if (kdeXLib->allowKdeDialogs()) - return kdeXLib->createFilePicker(xMSF); - else - return X11SalInstance::createFilePicker( xMSF ); -} - -SalX11Display* KDESalInstance::CreateDisplay() const -{ - return new SalKDEDisplay( QX11Info::display() ); -} - -bool KDESalInstance::IsMainThread() const -{ - return qApp->thread() == QThread::currentThread(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDESalInstance.hxx b/vcl/unx/kde4/KDESalInstance.hxx deleted file mode 100644 index 87328a88406e..000000000000 --- a/vcl/unx/kde4/KDESalInstance.hxx +++ /dev/null @@ -1,45 +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 - -#include - -class SalYieldMutex; -class SalFrame; - -class KDESalInstance : public X11SalInstance -{ -protected: - virtual SalX11Display* CreateDisplay() const override; - -public: - explicit KDESalInstance(std::unique_ptr pMutex); - virtual SalFrame* CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) override; - - virtual bool hasNativeFileSelection() const override { return true; } - - virtual css::uno::Reference< css::ui::dialogs::XFilePicker2 > - createFilePicker( const css::uno::Reference< - css::uno::XComponentContext >& ) override; - - virtual bool IsMainThread() const override; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx deleted file mode 100644 index 0852c543a6d7..000000000000 --- a/vcl/unx/kde4/KDEXLib.cxx +++ /dev/null @@ -1,426 +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 - -#include "KDEXLib.hxx" -#include "VCLKDEApplication.hxx" -#include "KDESalInstance.hxx" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "KDESalDisplay.hxx" - -#if KDE4_HAVE_GLIB -#include "KDE4FilePicker.hxx" -#include -#include -#endif - -KDEXLib::KDEXLib() : - SalXLib(), m_bStartupDone(false), - m_nFakeCmdLineArgs( 0 ), - m_isGlibEventLoopType(false), m_allowKdeDialogs(false), - m_timerEventId( -1 ), m_postUserEventId( -1 ) - , m_bTimedOut( false ) -{ - m_timerEventId = QEvent::registerEventType(); - m_postUserEventId = QEvent::registerEventType(); - - // the timers created here means they belong to the main thread. - // As the timeoutTimer runs the LO event queue, which may block on a dialog, - // the timer has to use a Qt::QueuedConnection, otherwise the nested event - // loop will detect the blocking timer and drop it from the polling - // freezing LO X11 processing. - timeoutTimer.setSingleShot( true ); - connect( &timeoutTimer, SIGNAL( timeout()), this, SLOT( timeoutActivated()), Qt::QueuedConnection ); - - // QTimer::start() can be called only in its (here main) thread, so this will - // forward between threads if needed - connect( this, SIGNAL( startTimeoutTimerSignal()), this, SLOT( startTimeoutTimer()), Qt::QueuedConnection ); - - // this one needs to be blocking, so that the handling in main thread is processed before - // the thread emitting the signal continues - connect( this, SIGNAL( processYieldSignal( bool, bool )), this, SLOT( processYield( bool, bool )), - Qt::BlockingQueuedConnection ); - - // Create the File picker in the main / GUI thread and block the calling thread until - // the FilePicker is created. - connect( this, SIGNAL( createFilePickerSignal( const css::uno::Reference< css::uno::XComponentContext >&) ), - this, SLOT( createFilePicker( const css::uno::Reference< css::uno::XComponentContext >&) ), - Qt::BlockingQueuedConnection ); -} - -KDEXLib::~KDEXLib() -{ - - // free the faked cmdline arguments no longer needed by KApplication - for( int i = 0; i < m_nFakeCmdLineArgs; i++ ) - { - free( m_pFreeCmdLineArgs[i] ); - } -} - -void KDEXLib::Init() -{ - m_pInputMethod.reset(new SalI18N_InputMethod); - m_pInputMethod->SetLocale(); - XrmInitialize(); - - KAboutData *kAboutData = new KAboutData( "LibreOffice", - "kdelibs4", - ki18n( "LibreOffice" ), - "3.6.0", - ki18n( "LibreOffice with KDE Native Widget Support." ), - KAboutData::License_File, - ki18n("Copyright (c) 2000, 2014 LibreOffice contributors" ), - ki18n( "LibreOffice is an office suite.\n" ), - "http://libreoffice.org", - "libreoffice@lists.freedesktop.org"); - - kAboutData->addAuthor( ki18n( "Jan Holesovsky" ), - ki18n( "Original author and maintainer of the KDE NWF." ), - "kendy@artax.karlin.mff.cuni.cz", - "http://artax.karlin.mff.cuni.cz/~kendy" ); - kAboutData->addAuthor( ki18n("Roman Shtylman"), - ki18n( "Porting to KDE 4." ), - "shtylman@gmail.com", "http://shtylman.com" ); - kAboutData->addAuthor( ki18n("Eric Bischoff"), - ki18n( "Accessibility fixes, porting to KDE 4." ), - "bischoff@kde.org" ); - - m_nFakeCmdLineArgs = 2; - - sal_uInt32 nParams = osl_getCommandArgCount(); - OString aDisplay; - OUString aParam, aBin; - - for ( sal_uInt32 nIdx = 0; nIdx < nParams; ++nIdx ) - { - osl_getCommandArg( nIdx, &aParam.pData ); - if ( !m_pFreeCmdLineArgs && aParam == "-display" && nIdx + 1 < nParams ) - { - osl_getCommandArg( nIdx + 1, &aParam.pData ); - aDisplay = OUStringToOString( aParam, osl_getThreadTextEncoding() ); - - m_pFreeCmdLineArgs = o3tl::make_unique(m_nFakeCmdLineArgs + 2); - m_pFreeCmdLineArgs[ m_nFakeCmdLineArgs + 0 ] = strdup( "-display" ); - m_pFreeCmdLineArgs[ m_nFakeCmdLineArgs + 1 ] = strdup( aDisplay.getStr() ); - m_nFakeCmdLineArgs += 2; - } - } - if ( !m_pFreeCmdLineArgs ) - m_pFreeCmdLineArgs = o3tl::make_unique(m_nFakeCmdLineArgs); - - osl_getExecutableFile( &aParam.pData ); - osl_getSystemPathFromFileURL( aParam.pData, &aBin.pData ); - OString aExec = OUStringToOString( aBin, osl_getThreadTextEncoding() ); - m_pFreeCmdLineArgs[0] = strdup( aExec.getStr() ); - m_pFreeCmdLineArgs[1] = strdup( "--nocrashhandler" ); - - // make a copy of the string list for freeing it since - // KApplication manipulates the pointers inside the argument vector - // note: KApplication bad ! - m_pAppCmdLineArgs = o3tl::make_unique(m_nFakeCmdLineArgs); - for( int i = 0; i < m_nFakeCmdLineArgs; i++ ) - m_pAppCmdLineArgs[i] = m_pFreeCmdLineArgs[i]; - - KCmdLineArgs::init( m_nFakeCmdLineArgs, m_pAppCmdLineArgs.get(), kAboutData ); - - // LO does its own session management, so prevent KDE/Qt from interfering - // (QApplication::disableSessionManagement(false) wouldn't quite do, - // since that still actually connects to the session manager, it just - // won't save the application data on session shutdown). - char* session_manager = nullptr; - if( getenv( "SESSION_MANAGER" ) != nullptr ) - { - session_manager = strdup( getenv( "SESSION_MANAGER" )); - unsetenv( "SESSION_MANAGER" ); - } - m_pApplication.reset( new VCLKDEApplication() ); - if( session_manager != nullptr ) - { - // coverity[tainted_string] - trusted source for setenv - setenv( "SESSION_MANAGER", session_manager, 1 ); - free( session_manager ); - } - - KApplication::setQuitOnLastWindowClosed(false); - -#if KDE4_HAVE_GLIB - m_isGlibEventLoopType = QAbstractEventDispatcher::instance()->inherits( "QEventDispatcherGlib" ); - // Using KDE dialogs (and their nested event loops) works only with a proper event loop integration - // that will release SolarMutex when waiting for more events. - // Moreover there are bugs in Qt event loop code that allow QClipboard recursing because the event - // loop processes also events that it should not at that point, so no dialogs in that case either. - // https://bugreports.qt-project.org/browse/QTBUG-37380 - // https://bugreports.qt-project.org/browse/QTBUG-34614 - if (m_isGlibEventLoopType && (0 == tst_processEventsExcludeSocket()) && tst_excludePostedEvents() == 0 ) - m_allowKdeDialogs = true; -#endif - - setupEventLoop(); - - m_pDisplay = QX11Info::display(); -} - -// When we use Qt event loop, it can actually use its own event loop handling, or wrap -// the Glib event loop (the latter is the default is Qt is built with Glib support -// and $QT_NO_GLIB is not set). We mostly do not care which one it is, as QSocketNotifier's -// and QTimer's can handle it transparently, but it matters for the SolarMutex, which -// needs to be unlocked shortly before entering the main sleep (e.g. select()) and locked -// immediately after. So we need to know which event loop implementation is used and -// hook accordingly. -#if KDE4_HAVE_GLIB -#include - -static GPollFunc old_gpoll = nullptr; - -static gint gpoll_wrapper( GPollFD* ufds, guint nfds, gint timeout ) -{ - SolarMutexReleaser aReleaser; - return old_gpoll( ufds, nfds, timeout ); -} -#endif - -static bool ( *old_qt_event_filter )( void* ); -static bool qt_event_filter( void* m ) -{ - if( old_qt_event_filter != nullptr && old_qt_event_filter( m )) - return true; - if( SalKDEDisplay::self() && SalKDEDisplay::self()->checkDirectInputEvent( static_cast< XEvent* >( m ))) - return true; - return false; -} - -void KDEXLib::setupEventLoop() -{ - old_qt_event_filter = QAbstractEventDispatcher::instance()->setEventFilter( qt_event_filter ); -#if KDE4_HAVE_GLIB - if( m_isGlibEventLoopType ) - { - old_gpoll = g_main_context_get_poll_func( nullptr ); - g_main_context_set_poll_func( nullptr, gpoll_wrapper ); - if( m_allowKdeDialogs ) - QApplication::clipboard()->setProperty( "useEventLoopWhenWaiting", true ); - return; - } -#endif -} - -void KDEXLib::Insert( int fd, void* data, YieldFunc pending, YieldFunc queued, YieldFunc handle ) -{ - if( !m_isGlibEventLoopType ) - return SalXLib::Insert( fd, data, pending, queued, handle ); - SocketData sdata; - sdata.data = data; - sdata.pending = pending; - sdata.queued = queued; - sdata.handle = handle; - // qApp as parent to make sure it uses the main thread event loop - sdata.notifier = new QSocketNotifier( fd, QSocketNotifier::Read, qApp ); - connect( sdata.notifier, SIGNAL( activated( int )), this, SLOT( socketNotifierActivated( int ))); - socketData[ fd ] = sdata; -} - -void KDEXLib::Remove( int fd ) -{ - if( !m_isGlibEventLoopType ) - return SalXLib::Remove( fd ); - SocketData sdata = socketData.take( fd );// according to SalXLib::Remove() this should be safe - delete sdata.notifier; -} - -void KDEXLib::socketNotifierActivated( int fd ) -{ - const SocketData& sdata = socketData[ fd ]; - sdata.handle( fd, sdata.data ); -} - -bool KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) -{ - bool bWasEvent = false; - if( !m_isGlibEventLoopType ) - { - if( qApp->thread() == QThread::currentThread()) - { - // even if we use the LO event loop, still process Qt's events, - // otherwise they can remain unhandled for quite a long while - bWasEvent = processYield( false, bHandleAllCurrentEvents ); - } - return SalXLib::Yield(bWait, bHandleAllCurrentEvents) || bWasEvent; - } - // if we are the main thread (which is where the event processing is done), - // good, just do it - if( qApp->thread() == QThread::currentThread()) - { - bWasEvent = processYield( bWait, bHandleAllCurrentEvents ); - if ( bWasEvent ) - m_aWaitingYieldCond.set(); - } - else - { - // we were called from another thread; - // release the yield lock to prevent deadlock with the main thread - // (it's ok to release it here, since even normal processYield() would - // temporarily do it while checking for new events) - { - SolarMutexReleaser aReleaser; - bWasEvent = Q_EMIT processYieldSignal( false, bHandleAllCurrentEvents ); - } - if ( !bWasEvent && bWait ) - { - m_aWaitingYieldCond.reset(); - SolarMutexReleaser aReleaser; - m_aWaitingYieldCond.wait(); - bWasEvent = true; - } - } - return bWasEvent; -} - -bool KDEXLib::processYield( bool bWait, bool bHandleAllCurrentEvents ) -{ - bool wasEvent = false; - if ( m_isGlibEventLoopType ) - { - wasEvent = SalKDEDisplay::self()->DispatchInternalEvent( bHandleAllCurrentEvents ); - if ( !bHandleAllCurrentEvents && wasEvent ) - return true; - } - - /** - * Quoting the Qt docs: [QAbstractEventDispatcher::processEvents] processes - * pending events that match flags until there are no more events to process. - */ - QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance( qApp->thread()); - if ( bWait && !wasEvent ) - wasEvent = dispatcher->processEvents( QEventLoop::WaitForMoreEvents ); - else - wasEvent = dispatcher->processEvents( QEventLoop::AllEvents ) || wasEvent; - return wasEvent; -} - -void KDEXLib::StartTimer( sal_uLong nMS ) -{ - if( !m_isGlibEventLoopType ) - return SalXLib::StartTimer( nMS ); - timeoutTimer.setInterval( nMS ); - // QTimer's can be started only in their thread (main thread here) - if( qApp->thread() == QThread::currentThread()) - startTimeoutTimer(); - else - Q_EMIT startTimeoutTimerSignal(); -} - -void KDEXLib::startTimeoutTimer() -{ - timeoutTimer.start(); -} - -void KDEXLib::StopTimer() -{ - if( !m_isGlibEventLoopType ) - return SalXLib::StopTimer(); - timeoutTimer.stop(); -} - -bool KDEXLib::CheckTimeout( bool bExecuteTimers ) -{ - if( !m_isGlibEventLoopType ) - return SalXLib::CheckTimeout( bExecuteTimers ); - assert( !bExecuteTimers ); - return m_bTimedOut; -} - -void KDEXLib::timeoutActivated() -{ - // don't potentially wait in timeout, as QTimer is non-recursive - m_bTimedOut = true; - QApplication::postEvent(this, new QEvent(QEvent::Type( m_timerEventId ))); -} - -void KDEXLib::customEvent(QEvent* e) -{ - if( e->type() == m_timerEventId ) - { - m_bTimedOut = false; - X11SalData::Timeout(); - } -} - -void KDEXLib::Wakeup() -{ - if( !m_isGlibEventLoopType ) - return SalXLib::Wakeup(); - QAbstractEventDispatcher::instance( qApp->thread())->wakeUp(); // main thread event loop -} - -void KDEXLib::TriggerUserEventProcessing() -{ - if( !m_isGlibEventLoopType ) - return SalXLib::TriggerUserEventProcessing(); - QApplication::postEvent(this, new QEvent(QEvent::Type( m_postUserEventId ))); -} - -void KDEXLib::doStartup() -{ - if( ! m_bStartupDone ) - { - KStartupInfo::appStarted(); - m_bStartupDone = true; - SAL_INFO( "vcl.kde4", "called KStartupInfo::appStarted()" ); - } -} - -using namespace com::sun::star; - -uno::Reference< ui::dialogs::XFilePicker2 > KDEXLib::createFilePicker( - const uno::Reference< uno::XComponentContext >& xMSF ) -{ -#if KDE4_HAVE_GLIB - if( qApp->thread() != QThread::currentThread()) { - SolarMutexReleaser aReleaser; - return Q_EMIT createFilePickerSignal( xMSF ); - } - return uno::Reference< ui::dialogs::XFilePicker2 >( new KDE4FilePicker( xMSF ) ); -#else - return NULL; -#endif -} - -#include - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDEXLib.hxx b/vcl/unx/kde4/KDEXLib.hxx deleted file mode 100644 index 452aae8b3286..000000000000 --- a/vcl/unx/kde4/KDEXLib.hxx +++ /dev/null @@ -1,101 +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 - -#include - -#include - -#include - -#include -#include -#include - -#include -#include - -class VCLKDEApplication; - -class KDEXLib : public QObject, public SalXLib -{ - Q_OBJECT - - bool m_bStartupDone; - std::unique_ptr m_pApplication; - std::unique_ptr m_pFreeCmdLineArgs; - std::unique_ptr m_pAppCmdLineArgs; - int m_nFakeCmdLineArgs; - struct SocketData - { - void* data; - YieldFunc pending; - YieldFunc queued; - YieldFunc handle; - QSocketNotifier* notifier; - }; - QHash< int, SocketData > socketData; // key is fd - QTimer timeoutTimer; - bool m_isGlibEventLoopType; - bool m_allowKdeDialogs; - int m_timerEventId; - int m_postUserEventId; - osl::Condition m_aWaitingYieldCond; - bool m_bTimedOut; - - void setupEventLoop(); - -private Q_SLOTS: - void socketNotifierActivated( int fd ); - void timeoutActivated(); - void startTimeoutTimer(); - bool processYield( bool bWait, bool bHandleAllCurrentEvents ); - -Q_SIGNALS: - void startTimeoutTimerSignal(); - bool processYieldSignal( bool bWait, bool bHandleAllCurrentEvents ); - css::uno::Reference< css::ui::dialogs::XFilePicker2 > - createFilePickerSignal( const css::uno::Reference< css::uno::XComponentContext >& ); - -public: - KDEXLib(); - virtual ~KDEXLib() override; - - virtual void Init() override; - virtual bool Yield( bool bWait, bool bHandleAllCurrentEvents ) override; - virtual void Insert( int fd, void* data, YieldFunc pending, YieldFunc queued, YieldFunc handle ) override; - virtual void Remove( int fd ) override; - virtual void StartTimer( sal_uLong nMS ) override; - virtual void StopTimer() override; - virtual bool CheckTimeout( bool bExecuteTimers = true ) override; - virtual void Wakeup() override; - void TriggerUserEventProcessing(); - - void doStartup(); - bool allowKdeDialogs() { return m_allowKdeDialogs; } - - virtual void customEvent(QEvent* e) override; - -public Q_SLOTS: - css::uno::Reference< css::ui::dialogs::XFilePicker2 > - createFilePicker( const css::uno::Reference< css::uno::XComponentContext >& ); -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/VCLKDEApplication.cxx b/vcl/unx/kde4/VCLKDEApplication.cxx deleted file mode 100644 index 78181b2a486c..000000000000 --- a/vcl/unx/kde4/VCLKDEApplication.cxx +++ /dev/null @@ -1,87 +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 "VCLKDEApplication.hxx" - -#include -#include - -#include "KDESalDisplay.hxx" - -VCLKDEApplication::VCLKDEApplication() : - KApplication() -{ -} - -bool VCLKDEApplication::x11EventFilter(XEvent* ev) -{ - //if we have a display and the display consumes the event - //do not process the event in qt - if (SalKDEDisplay::self() && SalKDEDisplay::self()->Dispatch(ev)) - { - return true; - } - - return false; -} - -// various hacks to be performed before re-entering Qt's event loop -// because of showing a Qt dialog -void VCLKDEApplication::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 VCLKDEApplication::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. - KGlobal::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/kde4/VCLKDEApplication.hxx b/vcl/unx/kde4/VCLKDEApplication.hxx deleted file mode 100644 index 622d898eb9bc..000000000000 --- a/vcl/unx/kde4/VCLKDEApplication.hxx +++ /dev/null @@ -1,39 +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 - -#include - -#include - -#include - -#undef Region - -class VCLKDEApplication : public KApplication -{ - public: - VCLKDEApplication(); - virtual bool x11EventFilter(XEvent* event) override; - static void preDialogSetup(); - static void postDialogCleanup(); -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/main.cxx b/vcl/unx/kde4/main.cxx deleted file mode 100644 index 9d192247679b..000000000000 --- a/vcl/unx/kde4/main.cxx +++ /dev/null @@ -1,89 +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 - -#include "KDEData.hxx" -#include "KDESalInstance.hxx" - -#include - -#include -#include - -/// entry point for the KDE4 VCL plugin -extern "C" { - VCLPLUG_KDE4_PUBLIC SalInstance* create_SalInstance() - { - /* #i92121# workaround deadlocks in the X11 implementation - */ - static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); - /* #i90094# - from now on we know that an X connection will be - established, so protect X against itself - */ - if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) - { -#if QT_VERSION >= 0x040800 - // let Qt call XInitThreads(), so that also Qt knows it's been used - // (otherwise QPixmap may warn about threads not being initialized) - QApplication::setAttribute( Qt::AA_X11InitThreads ); -#else - XInitThreads(); - // just in case somebody builds with old version and then upgrades Qt, - // otherwise this is a no-op - QApplication::setAttribute( static_cast< Qt::ApplicationAttribute >( 10 )); -#endif - } - -#if QT_VERSION < 0x050000 - // Qt 4.x support needs >= 4.1.0 - OString aVersion( qVersion() ); - SAL_INFO( "vcl.kde4", "qt version string is " << aVersion ); - - sal_Int32 nIndex = 0, nMajor = 0, nMinor = 0; - nMajor = aVersion.getToken( 0, '.', nIndex ).toInt32(); - if( nIndex > 0 ) - nMinor = aVersion.getToken( 0, '.', nIndex ).toInt32(); - if( nMajor != 4 || nMinor < 1 ) - { -#if OSL_DEBUG_LEVEL > 1 - sal_Int32 nMicro = 0; - if( nIndex > 0 ) - nMicro = aVersion.getToken( 0, '.', nIndex ).toInt32(); - SAL_INFO( "vcl.kde4", "unsuitable qt version " << nMajor << "." << nMinor << "." << nMicro ); -#endif - return nullptr; - } -#endif - - KDESalInstance* pInstance = new KDESalInstance( o3tl::make_unique() ); - SAL_INFO( "vcl.kde4", "created KDESalInstance " << &pInstance ); - - // initialize SalData - KDEData *salData = new KDEData( pInstance ); - salData->Init(); - salData->initNWF(); - pInstance->SetLib(salData->GetLib()); - - return pInstance; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/tst_exclude_posted_events.hxx b/vcl/unx/kde4/tst_exclude_posted_events.hxx deleted file mode 100644 index c07ca895a9dc..000000000000 --- a/vcl/unx/kde4/tst_exclude_posted_events.hxx +++ /dev/null @@ -1,67 +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 . - * - * This code is based on the SocketEventsTester from the Qt4 test suite. - */ - -#pragma once - -#include -#include - -const QEvent::Type eventType = QEvent::User; - -class TestExcludePostedEvents - : public QObject -{ - Q_OBJECT - public: - TestExcludePostedEvents(); - virtual bool event( QEvent* e ) override; - bool processed; -}; - -TestExcludePostedEvents::TestExcludePostedEvents() - : processed( false ) -{ -} - -bool TestExcludePostedEvents::event( QEvent* e ) -{ - if( e->type() == eventType ) - processed = true; - return QObject::event( e ); -} - -#define QVERIFY(a) \ - if (!a) return 1; - -static int tst_excludePostedEvents() -{ - TestExcludePostedEvents test; - QCoreApplication::postEvent( &test, new QEvent( eventType )); - QEventLoop loop; - loop.processEvents(QEventLoop::ExcludeUserInputEvents - | QEventLoop::ExcludeSocketNotifiers -// | QEventLoop::WaitForMoreEvents - | QEventLoop::X11ExcludeTimers); - QVERIFY( !test.processed ); - loop.processEvents(); - QVERIFY( test.processed ); - return 0; -} diff --git a/vcl/unx/kde4/tst_exclude_socket_notifiers.hxx b/vcl/unx/kde4/tst_exclude_socket_notifiers.hxx deleted file mode 100644 index d0acafede239..000000000000 --- a/vcl/unx/kde4/tst_exclude_socket_notifiers.hxx +++ /dev/null @@ -1,80 +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 . - * - * This code is based on the SocketEventsTester from the Qt4 test suite. - */ - -#pragma once - -#include -#include -#include -#include - -class TestExcludeSocketNotifiers - : public QObject -{ - Q_OBJECT - public: - TestExcludeSocketNotifiers( const int* pipes ); - virtual ~TestExcludeSocketNotifiers() override; - bool received; - public slots: - void slotReceived(); - private: - const int* pipes; -}; - -TestExcludeSocketNotifiers::TestExcludeSocketNotifiers( const int* thePipes ) - : received( false ) - , pipes( thePipes ) -{ -} - -TestExcludeSocketNotifiers::~TestExcludeSocketNotifiers() -{ - close( pipes[ 0 ] ); - close( pipes[ 1 ] ); -} - -void TestExcludeSocketNotifiers::slotReceived() -{ - received = true; -} - -#define QVERIFY(a) \ - if (!a) return 1; - -static int tst_processEventsExcludeSocket() -{ - int pipes[ 2 ]; - if( pipe( pipes ) < 0 ) - return 1; - TestExcludeSocketNotifiers test( pipes ); - QSocketNotifier notifier( pipes[ 0 ], QSocketNotifier::Read ); - QObject::connect( ¬ifier, SIGNAL( activated( int )), &test, SLOT( slotReceived())); - char dummy = 'a'; - if( 1 != write( pipes[ 1 ], &dummy, 1 ) ) - return 1; - QEventLoop loop; - loop.processEvents( QEventLoop::ExcludeSocketNotifiers ); - QVERIFY( !test.received ); - loop.processEvents(); - QVERIFY( test.received ); - return 0; -} diff --git a/vcl/unx/kde5/KDE5FilePicker2.cxx b/vcl/unx/kde5/KDE5FilePicker2.cxx index 553ed8500c84..dc87f90c84ce 100644 --- a/vcl/unx/kde5/KDE5FilePicker2.cxx +++ b/vcl/unx/kde5/KDE5FilePicker2.cxx @@ -68,10 +68,11 @@ namespace { uno::Sequence FilePicker_getSupportedServiceNames() { - uno::Sequence aRet(3); + uno::Sequence aRet(4); aRet[0] = "com.sun.star.ui.dialogs.FilePicker"; aRet[1] = "com.sun.star.ui.dialogs.SystemFilePicker"; aRet[2] = "com.sun.star.ui.dialogs.KDE5FilePicker"; + aRet[3] = "com.sun.star.ui.dialogs.KDE5FolderPicker"; return aRet; } } diff --git a/vcl/unx/kde5/KDE5SalInstance.cxx b/vcl/unx/kde5/KDE5SalInstance.cxx index 484920d01e97..d37654f7a73a 100644 --- a/vcl/unx/kde5/KDE5SalInstance.cxx +++ b/vcl/unx/kde5/KDE5SalInstance.cxx @@ -21,7 +21,6 @@ #include -//#include "KDE4FilePicker.hxx" #include #include #include -- cgit