From d3c6ac6d0f23df56644008ccb6aa2c8fa37ab1b5 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Tue, 9 Jul 2019 15:28:29 +0000 Subject: tdf#125922 rename kde5 to kf5 + plasma5 Just as the gtk3 plugin isn't named GNOME, rename kde5 to kf5, as it is based on the KDE frameworks 5 libraries. This also includes: * a convenience alias to load the kf5 VCL plugin in case someone requests the kde5 plugin. * keep convenience kde5 configure switch, but warn about it * rename detected desktop from kde5 to plasma5 Change-Id: I6764a05b81a5edbf284484c234fee2649aacf735 Reviewed-on: https://gerrit.libreoffice.org/75313 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski --- Repository.mk | 6 +- RepositoryExternal.mk | 10 +- bin/check-elf-dynamic-objects | 4 +- .../unusedfields.only-used-in-constructor.results | 8 +- .../clang/unusedfields.untouched.results | 4 +- config_host.mk.in | 2 +- config_host/config_vclplug.h.in | 2 +- configure.ac | 58 ++-- cui/source/options/optgdlg.cxx | 10 - .../Jenkins/LibreOfficeLinuxUpdater.conf | 2 +- distro-configs/Jenkins/Linux_dev_master.conf | 2 +- distro-configs/Jenkins/Linux_rel_master.conf | 2 +- distro-configs/Jenkins/linux_clang_dbgutil_64 | 2 +- distro-configs/Jenkins/linux_gcc_release_64 | 2 +- distro-configs/LibreOfficeCoverity.conf | 2 +- distro-configs/LibreOfficeLinux.conf | 2 +- distro-configs/LibreOfficeOnline.conf | 2 +- distro-configs/LibreOfficeOpenBSD.conf | 2 +- distro-configs/LibreOfficeiOS.conf | 2 +- distro-configs/LibreOfficeiOS_Sim.conf | 2 +- include/sal/log-areas.dox | 2 +- postprocess/Rdb_services.mk | 4 +- scp2/InstallScript_setup_osl.mk | 2 +- scp2/Module_scp2.mk | 2 +- shell/Library_kde5be.mk | 40 --- shell/Library_kf5be.mk | 40 +++ shell/Module_shell.mk | 4 +- shell/source/backends/desktopbe/desktopbackend.cxx | 8 +- shell/source/backends/kde5be/kde5access.cxx | 308 --------------------- shell/source/backends/kde5be/kde5access.hxx | 48 ---- shell/source/backends/kde5be/kde5backend.cxx | 279 ------------------- shell/source/backends/kde5be/kde5be1.component | 25 -- shell/source/backends/kf5be/kf5access.cxx | 308 +++++++++++++++++++++ shell/source/backends/kf5be/kf5access.hxx | 48 ++++ shell/source/backends/kf5be/kf5backend.cxx | 279 +++++++++++++++++++ shell/source/backends/kf5be/kf5be1.component | 25 ++ svtools/source/uno/fpicker.cxx | 8 +- vcl/CustomTarget_kde5_moc.mk | 21 -- vcl/CustomTarget_kf5_moc.mk | 21 ++ vcl/Executable_lo_kde5filepicker.mk | 2 +- vcl/Library_vcl.mk | 2 +- vcl/Library_vclplug_kde5.mk | 102 ------- vcl/Library_vclplug_kf5.mk | 102 +++++++ vcl/Module_vcl.mk | 12 +- vcl/README | 4 +- vcl/inc/unx/desktops.hxx | 2 +- vcl/inc/unx/gendata.hxx | 2 +- vcl/inc/vclpluginapi.h | 6 +- vcl/qa/cppunit/app/test_IconThemeSelector.cxx | 4 +- vcl/qt5/Qt5Frame.cxx | 4 +- vcl/source/app/IconThemeSelector.cxx | 2 +- vcl/source/app/salplug.cxx | 18 +- vcl/unx/generic/desktopdetect/desktopdetector.cxx | 21 +- vcl/unx/gtk3_kde5/kde5_filepicker.cxx | 4 +- vcl/unx/kde5/KDE5FilePicker.hxx | 65 ----- vcl/unx/kde5/KDE5FilePicker2.cxx | 210 -------------- vcl/unx/kde5/KDE5SalFrame.cxx | 222 --------------- vcl/unx/kde5/KDE5SalFrame.hxx | 47 ---- vcl/unx/kde5/KDE5SalInstance.cxx | 101 ------- vcl/unx/kde5/KDE5SalInstance.hxx | 36 --- vcl/unx/kf5/KF5FilePicker.cxx | 210 ++++++++++++++ vcl/unx/kf5/KF5FilePicker.hxx | 65 +++++ vcl/unx/kf5/KF5SalFrame.cxx | 222 +++++++++++++++ vcl/unx/kf5/KF5SalFrame.hxx | 47 ++++ vcl/unx/kf5/KF5SalInstance.cxx | 101 +++++++ vcl/unx/kf5/KF5SalInstance.hxx | 36 +++ 66 files changed, 1619 insertions(+), 1628 deletions(-) delete mode 100644 shell/Library_kde5be.mk create mode 100644 shell/Library_kf5be.mk delete mode 100644 shell/source/backends/kde5be/kde5access.cxx delete mode 100644 shell/source/backends/kde5be/kde5access.hxx delete mode 100644 shell/source/backends/kde5be/kde5backend.cxx delete mode 100644 shell/source/backends/kde5be/kde5be1.component create mode 100644 shell/source/backends/kf5be/kf5access.cxx create mode 100644 shell/source/backends/kf5be/kf5access.hxx create mode 100644 shell/source/backends/kf5be/kf5backend.cxx create mode 100644 shell/source/backends/kf5be/kf5be1.component delete mode 100644 vcl/CustomTarget_kde5_moc.mk create mode 100644 vcl/CustomTarget_kf5_moc.mk delete mode 100644 vcl/Library_vclplug_kde5.mk create mode 100644 vcl/Library_vclplug_kf5.mk delete mode 100644 vcl/unx/kde5/KDE5FilePicker.hxx delete mode 100644 vcl/unx/kde5/KDE5FilePicker2.cxx delete mode 100644 vcl/unx/kde5/KDE5SalFrame.cxx delete mode 100644 vcl/unx/kde5/KDE5SalFrame.hxx delete mode 100644 vcl/unx/kde5/KDE5SalInstance.cxx delete mode 100644 vcl/unx/kde5/KDE5SalInstance.hxx create mode 100644 vcl/unx/kf5/KF5FilePicker.cxx create mode 100644 vcl/unx/kf5/KF5FilePicker.hxx create mode 100644 vcl/unx/kf5/KF5SalFrame.cxx create mode 100644 vcl/unx/kf5/KF5SalFrame.hxx create mode 100644 vcl/unx/kf5/KF5SalInstance.cxx create mode 100644 vcl/unx/kf5/KF5SalInstance.hxx diff --git a/Repository.mk b/Repository.mk index 5717370c3be3..d292bd461201 100644 --- a/Repository.mk +++ b/Repository.mk @@ -298,9 +298,9 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,gnome, \ )) $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,kde, \ - $(if $(ENABLE_KDE5),kde5be1) \ + $(if $(ENABLE_KF5),kf5be1) \ $(if $(USING_X11), \ - $(if $(ENABLE_KDE5),vclplug_kde5) \ + $(if $(ENABLE_KF5),vclplug_kf5) \ $(if $(ENABLE_QT5),vclplug_qt5) \ $(if $(ENABLE_GTK3_KDE5),vclplug_gtk3_kde5) \ ) \ @@ -314,7 +314,7 @@ endif ifeq ($(OS),HAIKU) $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,haiku, \ $(if $(ENABLE_QT5),vclplug_qt5) \ - $(if $(ENABLE_KDE5),vclplug_kde5) \ + $(if $(ENABLE_KF5),vclplug_kf5) \ )) endif diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index 730a3408a240..a66077d3bcbb 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -3076,9 +3076,9 @@ endef endif # SYSTEM_POSTGRESQL -ifeq ($(ENABLE_KDE5),TRUE) +ifeq ($(ENABLE_KF5),TRUE) -define gb_LinkTarget__use_kde5 +define gb_LinkTarget__use_kf5 $(call gb_LinkTarget_set_include,$(1),\ $(subst -isystem/,-isystem /,$(filter -I% -isystem%,$(subst -isystem /,-isystem/,$(KF5_CFLAGS)))) \ $$(INCLUDE) \ @@ -3094,13 +3094,13 @@ $(call gb_LinkTarget_add_libs,$(1),\ endef -else # !ENABLE_KDE5 +else # !ENABLE_KF5 -define gb_LinkTarget__use_kde5 +define gb_LinkTarget__use_kf5 endef -endif # ENABLE_KDE5 +endif # ENABLE_KF5 diff --git a/bin/check-elf-dynamic-objects b/bin/check-elf-dynamic-objects index e1dec4b4f743..f2973c8b8ae0 100755 --- a/bin/check-elf-dynamic-objects +++ b/bin/check-elf-dynamic-objects @@ -121,8 +121,8 @@ local file="$1" */libavmediagst.so) whitelist="${whitelist} ${gtk3whitelist} ${gstreamerwhitelist}" ;; - */libvclplug_kde5lo.so|*/libkde5be1lo.so) - if [ "$ENABLE_KDE5" = TRUE ]; then + */libvclplug_kf5lo.so|*/libkf5be1lo.so) + if [ "$ENABLE_KF5" = TRUE ]; then whitelist="${whitelist} ${qt5whitelist} ${kf5whitelist}" fi ;; diff --git a/compilerplugins/clang/unusedfields.only-used-in-constructor.results b/compilerplugins/clang/unusedfields.only-used-in-constructor.results index 8229f7f54cc2..db4b5e7efed6 100644 --- a/compilerplugins/clang/unusedfields.only-used-in-constructor.results +++ b/compilerplugins/clang/unusedfields.only-used-in-constructor.results @@ -840,10 +840,10 @@ vcl/unx/gtk/gloactiongroup.cxx:30 GLOAction parent_instance GObject vcl/unx/gtk/glomenu.cxx:20 GLOMenu parent_instance const GMenuModel -vcl/unx/kde5/KDE5FilePicker.hxx:32 - KDE5FilePicker _layout class QGridLayout * -vcl/unx/kde5/KDE5FilePicker.hxx:34 - KDE5FilePicker allowRemoteUrls _Bool +vcl/unx/kf5/KF5FilePicker.hxx:32 + KF5FilePicker _layout class QGridLayout * +vcl/unx/kf5/KF5FilePicker.hxx:34 + KF5FilePicker allowRemoteUrls _Bool writerfilter/source/dmapper/PropertyMap.hxx:198 writerfilter::dmapper::SectionPropertyMap m_nDebugSectionNumber sal_Int32 xmloff/source/text/XMLTextListBlockContext.hxx:35 diff --git a/compilerplugins/clang/unusedfields.untouched.results b/compilerplugins/clang/unusedfields.untouched.results index 1f7b11f268f3..d7092855f60b 100644 --- a/compilerplugins/clang/unusedfields.untouched.results +++ b/compilerplugins/clang/unusedfields.untouched.results @@ -762,8 +762,8 @@ vcl/unx/gtk3/gtk3gtkinst.cxx:3532 CrippledViewport viewport GtkViewport vcl/unx/gtk/a11y/atkhypertext.cxx:29 HyperLink atk_hyper_link const AtkHyperlink -vcl/unx/kde5/KDE5FilePicker.hxx:34 - KDE5FilePicker allowRemoteUrls _Bool +vcl/unx/kf5/KF5FilePicker.hxx:34 + KF5FilePicker allowRemoteUrls _Bool writerfilter/source/ooxml/OOXMLStreamImpl.hxx:43 writerfilter::ooxml::OOXMLStreamImpl mxFastParser css::uno::Reference writerperfect/inc/WPFTEncodingDialog.hxx:37 diff --git a/config_host.mk.in b/config_host.mk.in index 28d3ae3d2626..8db0d6ddd779 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -167,7 +167,7 @@ export ENABLE_PDFIMPORT=@ENABLE_PDFIMPORT@ export ENABLE_PDFIUM=@ENABLE_PDFIUM@ export ENABLE_POPPLER=@ENABLE_POPPLER@ export ENABLE_QT5=@ENABLE_QT5@ -export ENABLE_KDE5=@ENABLE_KDE5@ +export ENABLE_KF5=@ENABLE_KF5@ export ENABLE_GTK3_KDE5=@ENABLE_GTK3_KDE5@ export ENABLE_RANDR=@ENABLE_RANDR@ export ENABLE_RELEASE_BUILD=@ENABLE_RELEASE_BUILD@ diff --git a/config_host/config_vclplug.h.in b/config_host/config_vclplug.h.in index 28b71d47a70a..694334dd4bf3 100644 --- a/config_host/config_vclplug.h.in +++ b/config_host/config_vclplug.h.in @@ -10,7 +10,7 @@ Settings about which desktops have support enabled. #define ENABLE_GTK 0 #define ENABLE_GTK3 0 #define ENABLE_GTK3_KDE5 0 -#define ENABLE_KDE5 0 +#define ENABLE_KF5 0 #define ENABLE_QT5 0 #define ENABLE_GSTREAMER_1_0 0 diff --git a/configure.ac b/configure.ac index 2ef45d1cdd7c..0358692fc1d6 100644 --- a/configure.ac +++ b/configure.ac @@ -616,7 +616,7 @@ solaris*) linux-gnu*|k*bsd*-gnu*) test_gtk=yes build_gstreamer_1_0=yes - test_kde5=yes + test_kf5=yes test_gtk3_kde5=yes test_gdb_index=yes test_split_debug=yes @@ -710,7 +710,7 @@ darwin*) # macOS or iOS freebsd*) test_gtk=yes build_gstreamer_1_0=yes - test_kde5=yes + test_kf5=yes test_gtk3_kde5=yes test_freetype=yes AC_MSG_CHECKING([the FreeBSD operating system release]) @@ -738,7 +738,7 @@ freebsd*) *netbsd*) test_gtk=yes build_gstreamer_1_0=yes - test_kde5=yes + test_kf5=yes test_gtk3_kde5=yes test_freetype=yes PTHREAD_LIBS="-pthread -lpthread" @@ -763,7 +763,7 @@ openbsd*) dragonfly*) test_gtk=yes build_gstreamer_1_0=yes - test_kde5=yes + test_kf5=yes test_gtk3_kde5=yes test_freetype=yes PTHREAD_LIBS="-pthread" @@ -785,7 +785,7 @@ linux-android*) test_fontconfig=no test_freetype=no test_gtk=no - test_kde5=no + test_kf5=no test_gtk3_kde5=no test_randr=no test_xrender=no @@ -1271,15 +1271,20 @@ AC_ARG_ENABLE(qt5, available.]), ,) -AC_ARG_ENABLE(kde5, - AS_HELP_STRING([--enable-kde5], +AC_ARG_ENABLE(kf5, + AS_HELP_STRING([--enable-kf5], [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and KF5 are available.]), ,) +AC_ARG_ENABLE(kde5, + AS_HELP_STRING([--enable-kde5], + [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!]) +,) + AC_ARG_ENABLE(gtk3_kde5, AS_HELP_STRING([--enable-gtk3-kde5], - [Determines whether to use Gtk3 vclplug with KDE file dialogs on + [Determines whether to use Gtk3 vclplug with KF5 file dialogs on platforms where Gtk3, Qt5 and Plasma is available.]), ,) @@ -4911,7 +4916,7 @@ if test "$USING_X11" != TRUE; then test_dbus=no test_gtk=no build_gstreamer_1_0=no - test_kde5=no + test_kf5=no test_qt5=no test_gtk3_kde5=no enable_cairo_canvas=no @@ -4919,16 +4924,22 @@ fi if test "$OS" = "HAIKU"; then enable_cairo_canvas=yes - test_kde5=yes + test_kf5=yes fi -if test "$test_kde5" = "yes"; then +if test "x$enable_kde5" = "xyes"; then + AC_MSG_WARN([The kde5 VCL plugin was renamed to kf5. Please update your configuration to use --enable-kf5, as --enable-kde5 will be removed after the next major release!]) + add_warning "The kde5 VCL plugin was renamed to kf5. Please update your configuration to use --enable-kf5, as --enable-kde5 will be removed after the next major release!" + test_kf5=yes +fi + +if test "$test_kf5" = "yes"; then test_qt5=yes fi -if test "$test_kde5" = "yes" -a "$enable_kde5" = "yes"; then +if test "$test_kf5" = "yes"; then if test "$enable_qt5" = "no"; then - AC_MSG_ERROR([KDE5 support depends on QT5, so it conflicts with --disable-qt5]) + AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5]) else enable_qt5=yes fi @@ -10461,13 +10472,13 @@ if test "x$enable_qt5" = "xyes"; then fi AC_SUBST(ENABLE_QT5) -ENABLE_KDE5="" -if test "x$enable_kde5" = "xyes"; then - ENABLE_KDE5="TRUE" - AC_DEFINE(ENABLE_KDE5) - R="$R kde5" +ENABLE_KF5="" +if test "x$enable_kf5" = "xyes"; then + ENABLE_KF5="TRUE" + AC_DEFINE(ENABLE_KF5) + R="$R kf5" fi -AC_SUBST(ENABLE_KDE5) +AC_SUBST(ENABLE_KF5) ENABLE_GTK3_KDE5="" if test "x$enable_gtk3_kde5" = "xyes"; then @@ -11246,7 +11257,7 @@ AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT) AC_SUBST(SYSTEM_RHINO) AC_SUBST(RHINO_JAR) -# This is only used in Qt5/KDE5 checks to determine if /usr/lib64 +# This is only used in Qt5/KF5 checks to determine if /usr/lib64 # paths should be added to library search path. So lets put all 64-bit # platforms there. supports_multilib= @@ -11271,7 +11282,7 @@ MOC5="moc" QT5_GOBJECT_CFLAGS="" QT5_GOBJECT_LIBS="" QT5_HAVE_GOBJECT="" -if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \ +if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \ \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \ \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \) then @@ -11369,14 +11380,13 @@ AC_SUBST(QT5_GOBJECT_LIBS) AC_SUBST(QT5_HAVE_GOBJECT) dnl =================================================================== -dnl KDE5 Integration +dnl KF5 Integration dnl =================================================================== KF5_CFLAGS="" KF5_LIBS="" KF5_CONFIG="kf5-config" -if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \ - \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \ +if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \ \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \) then if test "$OS" = "HAIKU"; then diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 91d3077c15f0..3da20f8b7ffd 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -206,16 +206,6 @@ namespace { OUString impl_SystemFileOpenServiceName() { - const OUString &rDesktopEnvironment = Application::GetDesktopEnvironment(); - - if ( rDesktopEnvironment.equalsIgnoreAsciiCase("kde5") ) - { - #if ENABLE_KDE5 - return OUString("com.sun.star.ui.dialogs.KDE5FilePicker" ); - #else - return OUString(); - #endif - } #if defined(_WIN32) return OUString("com.sun.star.ui.dialogs.SystemFilePicker"); #elif defined MACOSX diff --git a/distro-configs/Jenkins/LibreOfficeLinuxUpdater.conf b/distro-configs/Jenkins/LibreOfficeLinuxUpdater.conf index 0ccf7b4f1a14..3e34040ebe55 100644 --- a/distro-configs/Jenkins/LibreOfficeLinuxUpdater.conf +++ b/distro-configs/Jenkins/LibreOfficeLinuxUpdater.conf @@ -18,7 +18,7 @@ --with-external-dict-dir=/usr/share/hunspell --enable-dbus --enable-extension-integration -# --enable-kde5 +# --enable-kf5 --enable-gstreamer-1-0 --enable-evolution2 --enable-gio diff --git a/distro-configs/Jenkins/Linux_dev_master.conf b/distro-configs/Jenkins/Linux_dev_master.conf index 505e03568ad0..0f997e12ff29 100644 --- a/distro-configs/Jenkins/Linux_dev_master.conf +++ b/distro-configs/Jenkins/Linux_dev_master.conf @@ -1,4 +1,4 @@ --enable-dbgutil ---enable-kde5 +--enable-kf5 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 e98840407052..23b105fbe6b8 100644 --- a/distro-configs/Jenkins/Linux_rel_master.conf +++ b/distro-configs/Jenkins/Linux_rel_master.conf @@ -1,3 +1,3 @@ ---enable-kde5 +--enable-kf5 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_clang_dbgutil_64 b/distro-configs/Jenkins/linux_clang_dbgutil_64 index 2feee4326da6..c4f130f6d47e 100644 --- a/distro-configs/Jenkins/linux_clang_dbgutil_64 +++ b/distro-configs/Jenkins/linux_clang_dbgutil_64 @@ -1,4 +1,4 @@ --enable-dbgutil --enable-compiler-plugins COMPILER_PLUGINS_CXX=ccache g++ -std=c++11 ---enable-kde5 +--enable-kf5 diff --git a/distro-configs/Jenkins/linux_gcc_release_64 b/distro-configs/Jenkins/linux_gcc_release_64 index e2e56dc802eb..bda437aa57f0 100644 --- a/distro-configs/Jenkins/linux_gcc_release_64 +++ b/distro-configs/Jenkins/linux_gcc_release_64 @@ -1,3 +1,3 @@ CC=/opt/rh/devtoolset-7/root/usr/bin/gcc CXX=/opt/rh/devtoolset-7/root/usr/bin/g++ ---enable-kde5 +--enable-kf5 diff --git a/distro-configs/LibreOfficeCoverity.conf b/distro-configs/LibreOfficeCoverity.conf index eee0914ca2f0..e657f937fffe 100644 --- a/distro-configs/LibreOfficeCoverity.conf +++ b/distro-configs/LibreOfficeCoverity.conf @@ -13,7 +13,7 @@ --enable-dbus --enable-extension-integration --enable-gtk3 ---enable-kde5 +--enable-kf5 --enable-evolution2 --enable-scripting-beanshell --enable-scripting-javascript diff --git a/distro-configs/LibreOfficeLinux.conf b/distro-configs/LibreOfficeLinux.conf index d4337c4b2dfb..00a70c75010b 100644 --- a/distro-configs/LibreOfficeLinux.conf +++ b/distro-configs/LibreOfficeLinux.conf @@ -21,7 +21,7 @@ --enable-extension-integration --enable-odk --enable-gtk3-kde5 ---enable-kde5 +--enable-kf5 --enable-gstreamer-1-0 --enable-evolution2 --enable-gio diff --git a/distro-configs/LibreOfficeOnline.conf b/distro-configs/LibreOfficeOnline.conf index ed6de3293432..70b7824164f4 100644 --- a/distro-configs/LibreOfficeOnline.conf +++ b/distro-configs/LibreOfficeOnline.conf @@ -11,7 +11,7 @@ --disable-gtk --disable-gtk3 --disable-qt5 ---disable-kde5 +--disable-kf5 --disable-odk --disable-online-update --enable-pdfimport diff --git a/distro-configs/LibreOfficeOpenBSD.conf b/distro-configs/LibreOfficeOpenBSD.conf index 5bcfcaf76621..241b0153b605 100644 --- a/distro-configs/LibreOfficeOpenBSD.conf +++ b/distro-configs/LibreOfficeOpenBSD.conf @@ -1,6 +1,6 @@ --disable-dbus --disable-epm ---disable-kde5 +--disable-kf5 --disable-nss-module --disable-odk --enable-ext-wiki-publisher diff --git a/distro-configs/LibreOfficeiOS.conf b/distro-configs/LibreOfficeiOS.conf index 7786120e2279..9a15ad6b083f 100644 --- a/distro-configs/LibreOfficeiOS.conf +++ b/distro-configs/LibreOfficeiOS.conf @@ -19,7 +19,7 @@ --disable-database-connectivity --disable-dconf --disable-extensions ---disable-kde5 +--disable-kf5 --disable-odk --disable-openssl --disable-pdfium diff --git a/distro-configs/LibreOfficeiOS_Sim.conf b/distro-configs/LibreOfficeiOS_Sim.conf index 146be2bd3bcc..1a4b4dbafea1 100644 --- a/distro-configs/LibreOfficeiOS_Sim.conf +++ b/distro-configs/LibreOfficeiOS_Sim.conf @@ -19,7 +19,7 @@ --disable-database-connectivity --disable-dconf --disable-extensions ---disable-kde5 +--disable-kf5 --disable-odk --disable-openssl --disable-pdfium diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox index ac391bb3eb81..9666e497856c 100644 --- a/include/sal/log-areas.dox +++ b/include/sal/log-areas.dox @@ -479,7 +479,7 @@ certain functionality. @li @c vcl.helper @li @c vcl.icontest @li @c vcl.ios.clipboard -@li @c vcl.kde5 - KDE5 +@li @c vcl.kf5 - KF5 @li @c vcl.layout - Widget layout @li @c vcl.lazydelete @li @c vcl.opengl diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk index 0b9e1cfcc9fb..ab2ded7ae3a0 100644 --- a/postprocess/Rdb_services.mk +++ b/postprocess/Rdb_services.mk @@ -207,8 +207,8 @@ $(eval $(call gb_Rdb_add_components,services,\ $(if $(ENABLE_VLC), \ avmedia/source/vlc/avmediavlc \ ) \ - $(if $(ENABLE_KDE5), \ - shell/source/backends/kde5be/kde5be1 \ + $(if $(ENABLE_KF5), \ + shell/source/backends/kf5be/kf5be1 \ ) \ $(if $(ENABLE_ONLINE_UPDATE), \ extensions/source/update/check/updchk.uno \ diff --git a/scp2/InstallScript_setup_osl.mk b/scp2/InstallScript_setup_osl.mk index 6c2496390883..081f9dc6e26c 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_QT5) $(ENABLE_KDE5) $(ENABLE_GTK3_KDE5)),\ + $(if $(filter TRUE,$(ENABLE_QT5) $(ENABLE_KF5) $(ENABLE_GTK3_KDE5)),\ scp2/kde \ ) \ $(if $(filter TRUE,$(ENABLE_ONLINE_UPDATE)),\ diff --git a/scp2/Module_scp2.mk b/scp2/Module_scp2.mk index 55ea333df005..33e89172afac 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_QT5) $(ENABLE_KDE5) $(ENABLE_GTK3_KDE5)),\ + $(if $(filter TRUE,$(ENABLE_QT5) $(ENABLE_KF5) $(ENABLE_GTK3_KDE5)),\ InstallModule_kde \ ) \ )) diff --git a/shell/Library_kde5be.mk b/shell/Library_kde5be.mk deleted file mode 100644 index a89892dee17f..000000000000 --- a/shell/Library_kde5be.mk +++ /dev/null @@ -1,40 +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,kde5be1)) - -$(eval $(call gb_Library_use_sdk_api,kde5be1)) - -$(eval $(call gb_Library_use_externals,kde5be1,\ - boost_headers \ - kde5 \ -)) - -$(eval $(call gb_Library_use_libraries,kde5be1,\ - cppu \ - cppuhelper \ - sal \ -)) - -$(eval $(call gb_Library_set_componentfile,kde5be1,shell/source/backends/kde5be/kde5be1)) - -$(eval $(call gb_Library_add_exception_objects,kde5be1,\ - shell/source/backends/kde5be/kde5access \ - shell/source/backends/kde5be/kde5backend \ -)) - -# Workaround for clang+icecream (clang's -frewrite-includes -# doesn't handle Qt5's QT_HAS_INCLUDE that Qt5 uses for ). -ifeq ($(COM_IS_CLANG),TRUE) -$(eval $(call gb_Library_add_cxxflags,kde5be1, \ - -include chrono \ -)) -endif - -# vim: set shiftwidth=4 tabstop=4 noexpandtab: diff --git a/shell/Library_kf5be.mk b/shell/Library_kf5be.mk new file mode 100644 index 000000000000..628145176e0f --- /dev/null +++ b/shell/Library_kf5be.mk @@ -0,0 +1,40 @@ +# -*- 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,kf5be1)) + +$(eval $(call gb_Library_use_sdk_api,kf5be1)) + +$(eval $(call gb_Library_use_externals,kf5be1,\ + boost_headers \ + kf5 \ +)) + +$(eval $(call gb_Library_use_libraries,kf5be1,\ + cppu \ + cppuhelper \ + sal \ +)) + +$(eval $(call gb_Library_set_componentfile,kf5be1,shell/source/backends/kf5be/kf5be1)) + +$(eval $(call gb_Library_add_exception_objects,kf5be1,\ + shell/source/backends/kf5be/kf5access \ + shell/source/backends/kf5be/kf5backend \ +)) + +# Workaround for clang+icecream (clang's -frewrite-includes +# doesn't handle Qt5's QT_HAS_INCLUDE that Qt5 uses for ). +ifeq ($(COM_IS_CLANG),TRUE) +$(eval $(call gb_Library_add_cxxflags,kf5be1, \ + -include chrono \ +)) +endif + +# vim: set shiftwidth=4 tabstop=4 noexpandtab: diff --git a/shell/Module_shell.mk b/shell/Module_shell.mk index a03e020bf4f7..a223aae617e0 100644 --- a/shell/Module_shell.mk +++ b/shell/Module_shell.mk @@ -30,9 +30,9 @@ $(eval $(call gb_Module_add_targets,shell,\ endif endif -ifeq ($(ENABLE_KDE5),TRUE) +ifeq ($(ENABLE_KF5),TRUE) $(eval $(call gb_Module_add_targets,shell,\ - Library_kde5be \ + Library_kf5be \ )) endif diff --git a/shell/source/backends/desktopbe/desktopbackend.cxx b/shell/source/backends/desktopbe/desktopbackend.cxx index 6b402a892427..2872438d4f96 100644 --- a/shell/source/backends/desktopbe/desktopbackend.cxx +++ b/shell/source/backends/desktopbe/desktopbackend.cxx @@ -304,11 +304,9 @@ css::uno::Reference< css::uno::XInterface > createInstance( // Fall back to the default if the specific backend is not available: css::uno::Reference< css::uno::XInterface > backend; - if ( desktop == "KDE5" ) { - backend = createBackend( - context, - "com.sun.star.configuration.backend.KDE5Backend"); - } + if (desktop == "PLASMA5") + backend = createBackend(context, + "com.sun.star.configuration.backend.KF5Backend"); return backend.is() ? backend : static_cast< cppu::OWeakObject * >(new Default); } diff --git a/shell/source/backends/kde5be/kde5access.cxx b/shell/source/backends/kde5be/kde5access.cxx deleted file mode 100644 index 6147c8f0a83d..000000000000 --- a/shell/source/backends/kde5be/kde5access.cxx +++ /dev/null @@ -1,308 +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 "kde5access.hxx" - -#include -#include -#include -#include -#include -#include - -#include - -#include -// #include - -#include -#include -#include -#include -#include -#include - -namespace kde5access -{ -namespace -{ -namespace uno = css::uno; -} - -css::beans::Optional getValue(OUString const& id) -{ - if (id == "ExternalMailer") - { - KEMailSettings aEmailSettings; - QString aClientProgram; - OUString sClientProgram; - - aClientProgram = aEmailSettings.getSetting(KEMailSettings::ClientProgram); - if (aClientProgram.isEmpty()) - aClientProgram = QStringLiteral("kmail"); - else - aClientProgram = aClientProgram.section(QLatin1Char(' '), 0, 0); - sClientProgram = reinterpret_cast(aClientProgram.utf16()); - return css::beans::Optional(true, uno::makeAny(sClientProgram)); - } - else if (id == "SourceViewFontHeight") - { - const QFont aFixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); - const short nFontHeight = aFixedFont.pointSize(); - return css::beans::Optional(true, uno::makeAny(nFontHeight)); - } - else if (id == "SourceViewFontName") - { - const QFont aFixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); - const QString aFontName = aFixedFont.family(); - const OUString sFontName = reinterpret_cast(aFontName.utf16()); - return css::beans::Optional(true, uno::makeAny(sFontName)); - } - else if (id == "EnableATToolSupport") - { - /* does not make much sense without an accessibility bridge */ - bool ATToolSupport = false; - return css::beans::Optional(true, - uno::makeAny(OUString::boolean(ATToolSupport))); - } - else if (id == "WorkPathVariable") - { - QString aDocumentsDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)); - if (aDocumentsDir.isEmpty()) - aDocumentsDir = QDir::homePath(); - OUString sDocumentsDir; - OUString sDocumentsURL; - if (aDocumentsDir.endsWith(QLatin1Char('/'))) - aDocumentsDir.truncate(aDocumentsDir.length() - 1); - sDocumentsDir = reinterpret_cast(aDocumentsDir.utf16()); - osl_getFileURLFromSystemPath(sDocumentsDir.pData, &sDocumentsURL.pData); - return css::beans::Optional(true, uno::makeAny(sDocumentsURL)); - } - else if (id == "ooInetFTPProxyName") - { - QString aFTPProxy; - switch (KProtocolManager::proxyType()) - { - case KProtocolManager::ManualProxy: // Proxies are manually configured - aFTPProxy = KProtocolManager::proxyFor(QStringLiteral("FTP")); - break; - case KProtocolManager::PACProxy: // A proxy configuration URL has been given - case KProtocolManager::WPADProxy: // A proxy should be automatically discovered - case KProtocolManager::EnvVarProxy: // 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( - QUrl(QStringLiteral("ftp://ftp.libreoffice.org"))); - break; - default: // No proxy is used - break; - } - if (!aFTPProxy.isEmpty()) - { - QUrl aProxy(aFTPProxy); - OUString sProxy = reinterpret_cast(aProxy.host().utf16()); - return css::beans::Optional(true, uno::makeAny(sProxy)); - } - } - else if (id == "ooInetFTPProxyPort") - { - QString aFTPProxy; - switch (KProtocolManager::proxyType()) - { - case KProtocolManager::ManualProxy: // Proxies are manually configured - aFTPProxy = KProtocolManager::proxyFor(QStringLiteral("FTP")); - break; - case KProtocolManager::PACProxy: // A proxy configuration URL has been given - case KProtocolManager::WPADProxy: // A proxy should be automatically discovered - case KProtocolManager::EnvVarProxy: // 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( - QUrl(QStringLiteral("ftp://ftp.libreoffice.org"))); - break; - default: // No proxy is used - break; - } - if (!aFTPProxy.isEmpty()) - { - QUrl aProxy(aFTPProxy); - sal_Int32 nPort = aProxy.port(); - return css::beans::Optional(true, uno::makeAny(nPort)); - } - } - else if (id == "ooInetHTTPProxyName") - { - QString aHTTPProxy; - switch (KProtocolManager::proxyType()) - { - case KProtocolManager::ManualProxy: // Proxies are manually configured - aHTTPProxy = KProtocolManager::proxyFor(QStringLiteral("HTTP")); - break; - case KProtocolManager::PACProxy: // A proxy configuration URL has been given - case KProtocolManager::WPADProxy: // A proxy should be automatically discovered - case KProtocolManager::EnvVarProxy: // 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( - QUrl(QStringLiteral("http://www.libreoffice.org"))); - break; - default: // No proxy is used - break; - } - if (!aHTTPProxy.isEmpty()) - { - QUrl aProxy(aHTTPProxy); - OUString sProxy = reinterpret_cast(aProxy.host().utf16()); - return css::beans::Optional(true, uno::makeAny(sProxy)); - } - } - else if (id == "ooInetHTTPProxyPort") - { - QString aHTTPProxy; - switch (KProtocolManager::proxyType()) - { - case KProtocolManager::ManualProxy: // Proxies are manually configured - aHTTPProxy = KProtocolManager::proxyFor(QStringLiteral("HTTP")); - break; - case KProtocolManager::PACProxy: // A proxy configuration URL has been given - case KProtocolManager::WPADProxy: // A proxy should be automatically discovered - case KProtocolManager::EnvVarProxy: // 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( - QUrl(QStringLiteral("http://www.libreoffice.org"))); - break; - default: // No proxy is used - break; - } - if (!aHTTPProxy.isEmpty()) - { - QUrl aProxy(aHTTPProxy); - sal_Int32 nPort = aProxy.port(); - return css::beans::Optional(true, uno::makeAny(nPort)); - } - } - else if (id == "ooInetHTTPSProxyName") - { - QString aHTTPSProxy; - switch (KProtocolManager::proxyType()) - { - case KProtocolManager::ManualProxy: // Proxies are manually configured - aHTTPSProxy = KProtocolManager::proxyFor(QStringLiteral("HTTPS")); - break; - case KProtocolManager::PACProxy: // A proxy configuration URL has been given - case KProtocolManager::WPADProxy: // A proxy should be automatically discovered - case KProtocolManager::EnvVarProxy: // 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( - QUrl(QStringLiteral("https://www.libreoffice.org"))); - break; - default: // No proxy is used - break; - } - if (!aHTTPSProxy.isEmpty()) - { - QUrl aProxy(aHTTPSProxy); - OUString sProxy = reinterpret_cast(aProxy.host().utf16()); - return css::beans::Optional(true, uno::makeAny(sProxy)); - } - } - else if (id == "ooInetHTTPSProxyPort") - { - QString aHTTPSProxy; - switch (KProtocolManager::proxyType()) - { - case KProtocolManager::ManualProxy: // Proxies are manually configured - aHTTPSProxy = KProtocolManager::proxyFor(QStringLiteral("HTTPS")); - break; - case KProtocolManager::PACProxy: // A proxy configuration URL has been given - case KProtocolManager::WPADProxy: // A proxy should be automatically discovered - case KProtocolManager::EnvVarProxy: // 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( - QUrl(QStringLiteral("https://www.libreoffice.org"))); - break; - default: // No proxy is used - break; - } - if (!aHTTPSProxy.isEmpty()) - { - QUrl aProxy(aHTTPSProxy); - sal_Int32 nPort = aProxy.port(); - return css::beans::Optional(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: // Proxy values set through environment variables - aNoProxyFor = KProtocolManager::noProxyFor(); - break; - default: // No proxy is used - break; - } - if (!aNoProxyFor.isEmpty()) - { - OUString sNoProxyFor; - - aNoProxyFor = aNoProxyFor.replace(QLatin1Char(','), QLatin1Char(';')); - sNoProxyFor = reinterpret_cast(aNoProxyFor.utf16()); - return css::beans::Optional(true, uno::makeAny(sNoProxyFor)); - } - } - else if (id == "ooInetProxyType") - { - sal_Int32 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: // Proxy values set through environment variables - nProxyType = 1; - break; - default: // No proxy is used - nProxyType = 0; - } - return css::beans::Optional(true, uno::makeAny(nProxyType)); - } - else - { - OSL_ASSERT(false); // this cannot happen - } - return css::beans::Optional(); -} -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/backends/kde5be/kde5access.hxx b/shell/source/backends/kde5be/kde5access.hxx deleted file mode 100644 index e1e8a11c8a94..000000000000 --- a/shell/source/backends/kde5be/kde5access.hxx +++ /dev/null @@ -1,48 +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_KDE5BE_KDE5ACCESS_HXX -#define INCLUDED_SHELL_SOURCE_BACKENDS_KDE5BE_KDE5ACCESS_HXX - -#include - -#include - -namespace com -{ -namespace sun -{ -namespace star -{ -namespace uno -{ -class Any; -} -} -} -} - -namespace kde5access -{ -css::beans::Optional getValue(OUString const& id); -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/backends/kde5be/kde5backend.cxx b/shell/source/backends/kde5be/kde5backend.cxx deleted file mode 100644 index 101a21387a4c..000000000000 --- a/shell/source/backends/kde5be/kde5backend.cxx +++ /dev/null @@ -1,279 +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 - -#include -#include - -#include "kde5access.hxx" - -namespace -{ -OUString getServiceImplementationName() -{ - return OUString("com.sun.star.comp.configuration.backend.KDE5Backend"); -} - -css::uno::Sequence getServiceSupportedServiceNames() -{ - OUString name("com.sun.star.configuration.backend.KDE5Backend"); - return css::uno::Sequence(&name, 1); -} - -class Service : public cppu::WeakImplHelper, - private boost::noncopyable -{ -public: - Service(); - -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 SAL_CALL getSupportedServiceNames() override - { - return getServiceSupportedServiceNames(); - } - - virtual css::uno::Reference SAL_CALL getPropertySetInfo() override - { - return css::uno::Reference(); - } - - 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 const&) override - { - } - - virtual void SAL_CALL removePropertyChangeListener( - OUString const&, css::uno::Reference const&) override - { - } - - virtual void SAL_CALL addVetoableChangeListener( - OUString const&, css::uno::Reference const&) override - { - } - - virtual void SAL_CALL removeVetoableChangeListener( - OUString const&, css::uno::Reference const&) override - { - } - - std::map> m_KDESettings; -}; - -OString getDisplayArg() -{ - OUString aParam; - const sal_uInt32 nParams = osl_getCommandArgCount(); - for (sal_uInt32 nIdx = 0; nIdx < nParams; ++nIdx) - { - osl_getCommandArg(nIdx, &aParam.pData); - if (aParam != "-display") - continue; - - ++nIdx; - osl_getCommandArg(nIdx, &aParam.pData); - return OUStringToOString(aParam, osl_getThreadTextEncoding()); - } - return {}; -} - -OString getExecutable() -{ - OUString aParam, aBin; - osl_getExecutableFile(&aParam.pData); - osl_getSystemPathFromFileURL(aParam.pData, &aBin.pData); - return OUStringToOString(aBin, osl_getThreadTextEncoding()); -} - -void readKDESettings(std::map>& rSettings) -{ - const std::vector aKeys - = { "EnableATToolSupport", "ExternalMailer", "SourceViewFontHeight", - "SourceViewFontName", "WorkPathVariable", "ooInetFTPProxyName", - "ooInetFTPProxyPort", "ooInetHTTPProxyName", "ooInetHTTPProxyPort", - "ooInetHTTPSProxyName", "ooInetHTTPSProxyPort", "ooInetNoProxy", - "ooInetProxyType" }; - - for (const OUString& aKey : aKeys) - { - css::beans::Optional aValue = kde5access::getValue(aKey); - std::pair> elem - = std::make_pair(aKey, aValue); - rSettings.insert(elem); - } -} - -// init the QApplication when we load the kde5backend into a non-Qt vclplug (e.g. Gtk3KDE5) -// TODO: use a helper process to read these values without linking to Qt directly? -// TODO: share this code somehow with Qt5Instance.cxx? -void initQApp(std::map>& rSettings) -{ - const auto aDisplay = getDisplayArg(); - int nFakeArgc = aDisplay.isEmpty() ? 2 : 3; - char** pFakeArgv = new char*[nFakeArgc]; - - pFakeArgv[0] = strdup(getExecutable().getStr()); - pFakeArgv[1] = strdup("--nocrashhandler"); - if (!aDisplay.isEmpty()) - pFakeArgv[2] = strdup(aDisplay.getStr()); - - char* session_manager = nullptr; - if (auto* session_manager_env = getenv("SESSION_MANAGER")) - { - session_manager = strdup(session_manager_env); - unsetenv("SESSION_MANAGER"); - } - - std::unique_ptr app(new QApplication(nFakeArgc, pFakeArgv)); - QObject::connect(app.get(), &QObject::destroyed, app.get(), [nFakeArgc, pFakeArgv]() { - for (int i = 0; i < nFakeArgc; ++i) - delete pFakeArgv[i]; - delete[] pFakeArgv; - }); - - readKDESettings(rSettings); - - if (session_manager != nullptr) - { - // coverity[tainted_string] - trusted source for setenv - setenv("SESSION_MANAGER", session_manager, 1); - free(session_manager); - } -} - -Service::Service() -{ - css::uno::Reference context(css::uno::getCurrentContext()); - if (context.is()) - { - OUString desktop; - context->getValueByName("system.desktop-environment") >>= desktop; - - if (desktop == "KDE5") - { - if (!qApp) // no qt event loop yet - { - // so we start one and read KDE settings - initQApp(m_KDESettings); - } - else // someone else (most likely kde/qt vclplug) has started qt event loop - // all that is left to do is to read KDE settings - readKDESettings(m_KDESettings); - } - } -} - -void Service::setPropertyValue(OUString const&, css::uno::Any const&) -{ - throw css::lang::IllegalArgumentException("setPropertyValue not supported", - static_cast(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") - { - std::map>::iterator it - = m_KDESettings.find(PropertyName); - if (it != m_KDESettings.end()) - return css::uno::makeAny(it->second); - else - return css::uno::makeAny(css::beans::Optional()); - } - else if (PropertyName == "givenname" || PropertyName == "sn" - || PropertyName == "TemplatePathVariable") - { - return css::uno::makeAny(css::beans::Optional()); - //TODO: obtain values from KDE? - } - throw css::beans::UnknownPropertyException(PropertyName, static_cast(this)); -} - -css::uno::Reference -createInstance(css::uno::Reference const&) -{ - return static_cast(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* -kde5be1_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/kde5be/kde5be1.component b/shell/source/backends/kde5be/kde5be1.component deleted file mode 100644 index 74111874cb6b..000000000000 --- a/shell/source/backends/kde5be/kde5be1.component +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - diff --git a/shell/source/backends/kf5be/kf5access.cxx b/shell/source/backends/kf5be/kf5access.cxx new file mode 100644 index 000000000000..00db5c5448b4 --- /dev/null +++ b/shell/source/backends/kf5be/kf5access.cxx @@ -0,0 +1,308 @@ +/* -*- 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 "kf5access.hxx" + +#include +#include +#include +#include +#include +#include + +#include + +#include +// #include + +#include +#include +#include +#include +#include +#include + +namespace kf5access +{ +namespace +{ +namespace uno = css::uno; +} + +css::beans::Optional getValue(OUString const& id) +{ + if (id == "ExternalMailer") + { + KEMailSettings aEmailSettings; + QString aClientProgram; + OUString sClientProgram; + + aClientProgram = aEmailSettings.getSetting(KEMailSettings::ClientProgram); + if (aClientProgram.isEmpty()) + aClientProgram = QStringLiteral("kmail"); + else + aClientProgram = aClientProgram.section(QLatin1Char(' '), 0, 0); + sClientProgram = reinterpret_cast(aClientProgram.utf16()); + return css::beans::Optional(true, uno::makeAny(sClientProgram)); + } + else if (id == "SourceViewFontHeight") + { + const QFont aFixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); + const short nFontHeight = aFixedFont.pointSize(); + return css::beans::Optional(true, uno::makeAny(nFontHeight)); + } + else if (id == "SourceViewFontName") + { + const QFont aFixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); + const QString aFontName = aFixedFont.family(); + const OUString sFontName = reinterpret_cast(aFontName.utf16()); + return css::beans::Optional(true, uno::makeAny(sFontName)); + } + else if (id == "EnableATToolSupport") + { + /* does not make much sense without an accessibility bridge */ + bool ATToolSupport = false; + return css::beans::Optional(true, + uno::makeAny(OUString::boolean(ATToolSupport))); + } + else if (id == "WorkPathVariable") + { + QString aDocumentsDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)); + if (aDocumentsDir.isEmpty()) + aDocumentsDir = QDir::homePath(); + OUString sDocumentsDir; + OUString sDocumentsURL; + if (aDocumentsDir.endsWith(QLatin1Char('/'))) + aDocumentsDir.truncate(aDocumentsDir.length() - 1); + sDocumentsDir = reinterpret_cast(aDocumentsDir.utf16()); + osl_getFileURLFromSystemPath(sDocumentsDir.pData, &sDocumentsURL.pData); + return css::beans::Optional(true, uno::makeAny(sDocumentsURL)); + } + else if (id == "ooInetFTPProxyName") + { + QString aFTPProxy; + switch (KProtocolManager::proxyType()) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aFTPProxy = KProtocolManager::proxyFor(QStringLiteral("FTP")); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // 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( + QUrl(QStringLiteral("ftp://ftp.libreoffice.org"))); + break; + default: // No proxy is used + break; + } + if (!aFTPProxy.isEmpty()) + { + QUrl aProxy(aFTPProxy); + OUString sProxy = reinterpret_cast(aProxy.host().utf16()); + return css::beans::Optional(true, uno::makeAny(sProxy)); + } + } + else if (id == "ooInetFTPProxyPort") + { + QString aFTPProxy; + switch (KProtocolManager::proxyType()) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aFTPProxy = KProtocolManager::proxyFor(QStringLiteral("FTP")); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // 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( + QUrl(QStringLiteral("ftp://ftp.libreoffice.org"))); + break; + default: // No proxy is used + break; + } + if (!aFTPProxy.isEmpty()) + { + QUrl aProxy(aFTPProxy); + sal_Int32 nPort = aProxy.port(); + return css::beans::Optional(true, uno::makeAny(nPort)); + } + } + else if (id == "ooInetHTTPProxyName") + { + QString aHTTPProxy; + switch (KProtocolManager::proxyType()) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aHTTPProxy = KProtocolManager::proxyFor(QStringLiteral("HTTP")); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // 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( + QUrl(QStringLiteral("http://www.libreoffice.org"))); + break; + default: // No proxy is used + break; + } + if (!aHTTPProxy.isEmpty()) + { + QUrl aProxy(aHTTPProxy); + OUString sProxy = reinterpret_cast(aProxy.host().utf16()); + return css::beans::Optional(true, uno::makeAny(sProxy)); + } + } + else if (id == "ooInetHTTPProxyPort") + { + QString aHTTPProxy; + switch (KProtocolManager::proxyType()) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aHTTPProxy = KProtocolManager::proxyFor(QStringLiteral("HTTP")); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // 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( + QUrl(QStringLiteral("http://www.libreoffice.org"))); + break; + default: // No proxy is used + break; + } + if (!aHTTPProxy.isEmpty()) + { + QUrl aProxy(aHTTPProxy); + sal_Int32 nPort = aProxy.port(); + return css::beans::Optional(true, uno::makeAny(nPort)); + } + } + else if (id == "ooInetHTTPSProxyName") + { + QString aHTTPSProxy; + switch (KProtocolManager::proxyType()) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aHTTPSProxy = KProtocolManager::proxyFor(QStringLiteral("HTTPS")); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // 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( + QUrl(QStringLiteral("https://www.libreoffice.org"))); + break; + default: // No proxy is used + break; + } + if (!aHTTPSProxy.isEmpty()) + { + QUrl aProxy(aHTTPSProxy); + OUString sProxy = reinterpret_cast(aProxy.host().utf16()); + return css::beans::Optional(true, uno::makeAny(sProxy)); + } + } + else if (id == "ooInetHTTPSProxyPort") + { + QString aHTTPSProxy; + switch (KProtocolManager::proxyType()) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aHTTPSProxy = KProtocolManager::proxyFor(QStringLiteral("HTTPS")); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // 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( + QUrl(QStringLiteral("https://www.libreoffice.org"))); + break; + default: // No proxy is used + break; + } + if (!aHTTPSProxy.isEmpty()) + { + QUrl aProxy(aHTTPSProxy); + sal_Int32 nPort = aProxy.port(); + return css::beans::Optional(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: // Proxy values set through environment variables + aNoProxyFor = KProtocolManager::noProxyFor(); + break; + default: // No proxy is used + break; + } + if (!aNoProxyFor.isEmpty()) + { + OUString sNoProxyFor; + + aNoProxyFor = aNoProxyFor.replace(QLatin1Char(','), QLatin1Char(';')); + sNoProxyFor = reinterpret_cast(aNoProxyFor.utf16()); + return css::beans::Optional(true, uno::makeAny(sNoProxyFor)); + } + } + else if (id == "ooInetProxyType") + { + sal_Int32 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: // Proxy values set through environment variables + nProxyType = 1; + break; + default: // No proxy is used + nProxyType = 0; + } + return css::beans::Optional(true, uno::makeAny(nProxyType)); + } + else + { + OSL_ASSERT(false); // this cannot happen + } + return css::beans::Optional(); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/backends/kf5be/kf5access.hxx b/shell/source/backends/kf5be/kf5access.hxx new file mode 100644 index 000000000000..34ee7c6d3d6b --- /dev/null +++ b/shell/source/backends/kf5be/kf5access.hxx @@ -0,0 +1,48 @@ +/* -*- 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_KF5BE_KF5ACCESS_HXX +#define INCLUDED_SHELL_SOURCE_BACKENDS_KF5BE_KF5ACCESS_HXX + +#include + +#include + +namespace com +{ +namespace sun +{ +namespace star +{ +namespace uno +{ +class Any; +} +} +} +} + +namespace kf5access +{ +css::beans::Optional getValue(OUString const& id); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/backends/kf5be/kf5backend.cxx b/shell/source/backends/kf5be/kf5backend.cxx new file mode 100644 index 000000000000..182d24893456 --- /dev/null +++ b/shell/source/backends/kf5be/kf5backend.cxx @@ -0,0 +1,279 @@ +/* -*- 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 + +#include +#include + +#include "kf5access.hxx" + +namespace +{ +OUString getServiceImplementationName() +{ + return OUString("com.sun.star.comp.configuration.backend.KF5Backend"); +} + +css::uno::Sequence getServiceSupportedServiceNames() +{ + OUString name("com.sun.star.configuration.backend.KF5Backend"); + return css::uno::Sequence(&name, 1); +} + +class Service : public cppu::WeakImplHelper, + private boost::noncopyable +{ +public: + Service(); + +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 SAL_CALL getSupportedServiceNames() override + { + return getServiceSupportedServiceNames(); + } + + virtual css::uno::Reference SAL_CALL getPropertySetInfo() override + { + return css::uno::Reference(); + } + + 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 const&) override + { + } + + virtual void SAL_CALL removePropertyChangeListener( + OUString const&, css::uno::Reference const&) override + { + } + + virtual void SAL_CALL addVetoableChangeListener( + OUString const&, css::uno::Reference const&) override + { + } + + virtual void SAL_CALL removeVetoableChangeListener( + OUString const&, css::uno::Reference const&) override + { + } + + std::map> m_KDESettings; +}; + +OString getDisplayArg() +{ + OUString aParam; + const sal_uInt32 nParams = osl_getCommandArgCount(); + for (sal_uInt32 nIdx = 0; nIdx < nParams; ++nIdx) + { + osl_getCommandArg(nIdx, &aParam.pData); + if (aParam != "-display") + continue; + + ++nIdx; + osl_getCommandArg(nIdx, &aParam.pData); + return OUStringToOString(aParam, osl_getThreadTextEncoding()); + } + return {}; +} + +OString getExecutable() +{ + OUString aParam, aBin; + osl_getExecutableFile(&aParam.pData); + osl_getSystemPathFromFileURL(aParam.pData, &aBin.pData); + return OUStringToOString(aBin, osl_getThreadTextEncoding()); +} + +void readKDESettings(std::map>& rSettings) +{ + const std::vector aKeys + = { "EnableATToolSupport", "ExternalMailer", "SourceViewFontHeight", + "SourceViewFontName", "WorkPathVariable", "ooInetFTPProxyName", + "ooInetFTPProxyPort", "ooInetHTTPProxyName", "ooInetHTTPProxyPort", + "ooInetHTTPSProxyName", "ooInetHTTPSProxyPort", "ooInetNoProxy", + "ooInetProxyType" }; + + for (const OUString& aKey : aKeys) + { + css::beans::Optional aValue = kf5access::getValue(aKey); + std::pair> elem + = std::make_pair(aKey, aValue); + rSettings.insert(elem); + } +} + +// init the QApplication when we load the kf5backend into a non-Qt vclplug (e.g. gtk3_kde5) +// TODO: use a helper process to read these values without linking to Qt directly? +// TODO: share this code somehow with Qt5Instance.cxx? +void initQApp(std::map>& rSettings) +{ + const auto aDisplay = getDisplayArg(); + int nFakeArgc = aDisplay.isEmpty() ? 2 : 3; + char** pFakeArgv = new char*[nFakeArgc]; + + pFakeArgv[0] = strdup(getExecutable().getStr()); + pFakeArgv[1] = strdup("--nocrashhandler"); + if (!aDisplay.isEmpty()) + pFakeArgv[2] = strdup(aDisplay.getStr()); + + char* session_manager = nullptr; + if (auto* session_manager_env = getenv("SESSION_MANAGER")) + { + session_manager = strdup(session_manager_env); + unsetenv("SESSION_MANAGER"); + } + + std::unique_ptr app(new QApplication(nFakeArgc, pFakeArgv)); + QObject::connect(app.get(), &QObject::destroyed, app.get(), [nFakeArgc, pFakeArgv]() { + for (int i = 0; i < nFakeArgc; ++i) + delete pFakeArgv[i]; + delete[] pFakeArgv; + }); + + readKDESettings(rSettings); + + if (session_manager != nullptr) + { + // coverity[tainted_string] - trusted source for setenv + setenv("SESSION_MANAGER", session_manager, 1); + free(session_manager); + } +} + +Service::Service() +{ + css::uno::Reference context(css::uno::getCurrentContext()); + if (context.is()) + { + OUString desktop; + context->getValueByName("system.desktop-environment") >>= desktop; + + if (desktop == "PLASMA5") + { + if (!qApp) // no qt event loop yet + { + // so we start one and read KDE settings + initQApp(m_KDESettings); + } + else // someone else (most likely kde/qt vclplug) has started qt event loop + // all that is left to do is to read KDE settings + readKDESettings(m_KDESettings); + } + } +} + +void Service::setPropertyValue(OUString const&, css::uno::Any const&) +{ + throw css::lang::IllegalArgumentException("setPropertyValue not supported", + static_cast(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") + { + std::map>::iterator it + = m_KDESettings.find(PropertyName); + if (it != m_KDESettings.end()) + return css::uno::makeAny(it->second); + else + return css::uno::makeAny(css::beans::Optional()); + } + else if (PropertyName == "givenname" || PropertyName == "sn" + || PropertyName == "TemplatePathVariable") + { + return css::uno::makeAny(css::beans::Optional()); + //TODO: obtain values from KDE? + } + throw css::beans::UnknownPropertyException(PropertyName, static_cast(this)); +} + +css::uno::Reference +createInstance(css::uno::Reference const&) +{ + return static_cast(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* +kf5be1_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/kf5be/kf5be1.component b/shell/source/backends/kf5be/kf5be1.component new file mode 100644 index 000000000000..ad217dc80e66 --- /dev/null +++ b/shell/source/backends/kf5be/kf5be1.component @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/svtools/source/uno/fpicker.cxx b/svtools/source/uno/fpicker.cxx index e367a326e5c7..8ca591e1f692 100644 --- a/svtools/source/uno/fpicker.cxx +++ b/svtools/source/uno/fpicker.cxx @@ -39,9 +39,7 @@ static OUString FilePicker_getSystemPickerServiceName() { #ifdef UNX OUString aDesktopEnvironment (Application::GetDesktopEnvironment()); - if (aDesktopEnvironment.equalsIgnoreAsciiCase("kde5")) - return OUString ("com.sun.star.ui.dialogs.KDE5FilePicker"); - else if (aDesktopEnvironment.equalsIgnoreAsciiCase("macosx")) + if (aDesktopEnvironment.equalsIgnoreAsciiCase("macosx")) return OUString ("com.sun.star.ui.dialogs.AquaFilePicker"); else return OUString ("com.sun.star.ui.dialogs.SystemFilePicker"); @@ -113,9 +111,7 @@ static OUString FolderPicker_getSystemPickerServiceName() { #ifdef UNX OUString aDesktopEnvironment (Application::GetDesktopEnvironment()); - if (aDesktopEnvironment.equalsIgnoreAsciiCase("kde5")) - return OUString("com.sun.star.ui.dialogs.KDEFolderPicker"); - else if (aDesktopEnvironment.equalsIgnoreAsciiCase("macosx")) + if (aDesktopEnvironment.equalsIgnoreAsciiCase("macosx")) return OUString("com.sun.star.ui.dialogs.AquaFolderPicker"); #endif return OUString("com.sun.star.ui.dialogs.SystemFolderPicker"); diff --git a/vcl/CustomTarget_kde5_moc.mk b/vcl/CustomTarget_kde5_moc.mk deleted file mode 100644 index 8f9d65c27f31..000000000000 --- a/vcl/CustomTarget_kde5_moc.mk +++ /dev/null @@ -1,21 +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/kde5)) - -$(call gb_CustomTarget_get_target,vcl/unx/kde5) : \ - $(call gb_CustomTarget_get_workdir,vcl/unx/kde5)/KDE5FilePicker.moc - -$(call gb_CustomTarget_get_workdir,vcl/unx/kde5)/%.moc : \ - $(SRCDIR)/vcl/unx/kde5/%.hxx \ - | $(call gb_CustomTarget_get_workdir,vcl/unx/kde5)/.dir - $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),MOC,1) - $(MOC5) $< -o $@ - -# vim: set noet sw=4: diff --git a/vcl/CustomTarget_kf5_moc.mk b/vcl/CustomTarget_kf5_moc.mk new file mode 100644 index 000000000000..6247c58161fd --- /dev/null +++ b/vcl/CustomTarget_kf5_moc.mk @@ -0,0 +1,21 @@ +# -*- 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/kf5)) + +$(call gb_CustomTarget_get_target,vcl/unx/kf5) : \ + $(call gb_CustomTarget_get_workdir,vcl/unx/kf5)/KF5FilePicker.moc + +$(call gb_CustomTarget_get_workdir,vcl/unx/kf5)/%.moc : \ + $(SRCDIR)/vcl/unx/kf5/%.hxx \ + | $(call gb_CustomTarget_get_workdir,vcl/unx/kf5)/.dir + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),MOC,1) + $(MOC5) $< -o $@ + +# vim: set noet sw=4: diff --git a/vcl/Executable_lo_kde5filepicker.mk b/vcl/Executable_lo_kde5filepicker.mk index a34682966778..7d44b3fca120 100644 --- a/vcl/Executable_lo_kde5filepicker.mk +++ b/vcl/Executable_lo_kde5filepicker.mk @@ -68,7 +68,7 @@ $(eval $(call gb_Executable_use_libraries,lo_kde5filepicker,\ $(eval $(call gb_Executable_use_externals,lo_kde5filepicker,\ boost_headers \ epoxy \ - kde5 \ + kf5 \ dbus \ )) diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 25f11f0cbaea..1c3f0b31eb2d 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -603,7 +603,7 @@ $(eval $(call gb_Library_add_libs,vcl,\ )) $(eval $(call gb_Library_add_exception_objects,vcl, \ - $(if $(or $(ENABLE_QT5),$(ENABLE_KDE5)),vcl/source/app/salplug) \ + $(if $(or $(ENABLE_QT5),$(ENABLE_KF5)),vcl/source/app/salplug) \ )) $(eval $(call gb_Library_use_externals,vcl,\ diff --git a/vcl/Library_vclplug_kde5.mk b/vcl/Library_vclplug_kde5.mk deleted file mode 100644 index 8b5804185b3e..000000000000 --- a/vcl/Library_vclplug_kde5.mk +++ /dev/null @@ -1,102 +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_kde5)) - -$(eval $(call gb_Library_use_custom_headers,vclplug_kde5,vcl/unx/kde5)) - -$(eval $(call gb_Library_set_include,vclplug_kde5,\ - $$(INCLUDE) \ - -I$(SRCDIR)/vcl/inc \ - -I$(SRCDIR)/vcl/inc/qt5 \ -)) - -$(eval $(call gb_Library_add_defs,vclplug_kde5,\ - -DVCLPLUG_KDE5_IMPLEMENTATION \ -)) - -$(eval $(call gb_Library_use_sdk_api,vclplug_kde5)) - -$(eval $(call gb_Library_use_libraries,vclplug_kde5,\ - vclplug_qt5 \ - vcl \ - tl \ - utl \ - sot \ - ucbhelper \ - basegfx \ - comphelper \ - cppuhelper \ - i18nlangtag \ - i18nutil \ - $(if $(ENABLE_JAVA), \ - jvmaccess) \ - cppu \ - sal \ -)) - -$(eval $(call gb_Library_use_externals,vclplug_kde5,\ - boost_headers \ - cairo \ - graphite \ - harfbuzz \ - icuuc \ - kde5 \ - epoxy \ -)) - -ifneq ($(QT5_HAVE_GLIB),) -$(eval $(call gb_Library_add_cxxflags,vclplug_kde5,\ - $(QT5_GLIB_CFLAGS) \ -)) - -$(eval $(call gb_Library_add_libs,vclplug_kde5,\ - $(QT5_GLIB_LIBS) \ -)) -endif - -$(eval $(call gb_Library_add_cxxflags,vclplug_kde5,\ - $(KF5_CFLAGS) \ -)) -$(eval $(call gb_Library_add_libs,vclplug_kde5,\ - $(KF5_LIBS) \ -)) - -$(eval $(call gb_Library_add_exception_objects,vclplug_kde5,\ - vcl/unx/kde5/KDE5FilePicker2 \ - vcl/unx/kde5/KDE5SalFrame \ - vcl/unx/kde5/KDE5SalInstance \ -)) - -ifeq ($(OS),LINUX) -$(eval $(call gb_Library_add_libs,vclplug_kde5,\ - -lm \ - -ldl \ -)) -endif - -# Workaround for clang+icecream (clang's -frewrite-includes -# doesn't handle Qt5's QT_HAS_INCLUDE that Qt5 uses for ). -ifeq ($(COM_IS_CLANG),TRUE) -$(eval $(call gb_Library_add_cxxflags,vclplug_kde5, \ - -include chrono \ -)) -endif - -# vim: set noet sw=4 ts=4: diff --git a/vcl/Library_vclplug_kf5.mk b/vcl/Library_vclplug_kf5.mk new file mode 100644 index 000000000000..62dafe2c2536 --- /dev/null +++ b/vcl/Library_vclplug_kf5.mk @@ -0,0 +1,102 @@ +# -*- 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_kf5)) + +$(eval $(call gb_Library_use_custom_headers,vclplug_kf5,vcl/unx/kf5)) + +$(eval $(call gb_Library_set_include,vclplug_kf5,\ + $$(INCLUDE) \ + -I$(SRCDIR)/vcl/inc \ + -I$(SRCDIR)/vcl/inc/qt5 \ +)) + +$(eval $(call gb_Library_add_defs,vclplug_kf5,\ + -DVCLPLUG_KF5_IMPLEMENTATION \ +)) + +$(eval $(call gb_Library_use_sdk_api,vclplug_kf5)) + +$(eval $(call gb_Library_use_libraries,vclplug_kf5,\ + vclplug_qt5 \ + vcl \ + tl \ + utl \ + sot \ + ucbhelper \ + basegfx \ + comphelper \ + cppuhelper \ + i18nlangtag \ + i18nutil \ + $(if $(ENABLE_JAVA), \ + jvmaccess) \ + cppu \ + sal \ +)) + +$(eval $(call gb_Library_use_externals,vclplug_kf5,\ + boost_headers \ + cairo \ + graphite \ + harfbuzz \ + icuuc \ + kf5 \ + epoxy \ +)) + +ifneq ($(QT5_HAVE_GLIB),) +$(eval $(call gb_Library_add_cxxflags,vclplug_kf5,\ + $(QT5_GLIB_CFLAGS) \ +)) + +$(eval $(call gb_Library_add_libs,vclplug_kf5,\ + $(QT5_GLIB_LIBS) \ +)) +endif + +$(eval $(call gb_Library_add_cxxflags,vclplug_kf5,\ + $(KF5_CFLAGS) \ +)) +$(eval $(call gb_Library_add_libs,vclplug_kf5,\ + $(KF5_LIBS) \ +)) + +$(eval $(call gb_Library_add_exception_objects,vclplug_kf5,\ + vcl/unx/kf5/KF5FilePicker \ + vcl/unx/kf5/KF5SalFrame \ + vcl/unx/kf5/KF5SalInstance \ +)) + +ifeq ($(OS),LINUX) +$(eval $(call gb_Library_add_libs,vclplug_kf5,\ + -lm \ + -ldl \ +)) +endif + +# Workaround for clang+icecream (clang's -frewrite-includes +# doesn't handle Qt5's QT_HAS_INCLUDE that Qt5 uses for ). +ifeq ($(COM_IS_CLANG),TRUE) +$(eval $(call gb_Library_add_cxxflags,vclplug_kf5, \ + -include chrono \ +)) +endif + +# vim: set noet sw=4 ts=4: diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 78604ab0e9c4..54e3fbd6b07f 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -77,10 +77,10 @@ $(eval $(call gb_Module_add_targets,vcl,\ Library_vclplug_gtk3 \ )) endif -ifneq ($(ENABLE_KDE5),) +ifneq ($(ENABLE_KF5),) $(eval $(call gb_Module_add_targets,vcl,\ - CustomTarget_kde5_moc \ - Library_vclplug_kde5 \ + CustomTarget_kf5_moc \ + Library_vclplug_kf5 \ )) endif ifneq ($(ENABLE_QT5),) @@ -119,10 +119,10 @@ $(eval $(call gb_Module_add_targets,vcl,\ Library_vclplug_qt5 \ )) endif -ifneq ($(ENABLE_KDE5),) +ifneq ($(ENABLE_KF5),) $(eval $(call gb_Module_add_targets,vcl,\ - CustomTarget_kde5_moc \ - Library_vclplug_kde5 \ + CustomTarget_kf5_moc \ + Library_vclplug_kf5 \ )) endif endif diff --git a/vcl/README b/vcl/README index d8da537939b3..6ee9dad11e80 100644 --- a/vcl/README +++ b/vcl/README @@ -38,8 +38,8 @@ unx/ + GTK2 support gtk3/ + GTK3 support - kde5/ - + KDE5 support + kf5/ + + KF5 support gtk3_kde5/ + GTK3 support with KDE5 file pickers (alternative to native kde5 one) generic/ diff --git a/vcl/inc/unx/desktops.hxx b/vcl/inc/unx/desktops.hxx index a4a6700b7e96..531e4c64272b 100644 --- a/vcl/inc/unx/desktops.hxx +++ b/vcl/inc/unx/desktops.hxx @@ -31,7 +31,7 @@ enum SAL_DLLPUBLIC_RTTI DesktopType { DESKTOP_UNITY, DESKTOP_XFCE, DESKTOP_MATE, - DESKTOP_KDE5, + DESKTOP_PLASMA5, DESKTOP_LXQT }; // keep in sync with desktop_strings[] in salplug.cxx diff --git a/vcl/inc/unx/gendata.hxx b/vcl/inc/unx/gendata.hxx index 15f201931792..d8f8149ad6a7 100644 --- a/vcl/inc/unx/gendata.hxx +++ b/vcl/inc/unx/gendata.hxx @@ -27,7 +27,7 @@ enum GenericUnixSalDataType { SAL_DATA_GTK, SAL_DATA_GTK3, - SAL_DATA_KDE5, + SAL_DATA_KF5, SAL_DATA_UNX, SAL_DATA_SVP, SAL_DATA_ANDROID, diff --git a/vcl/inc/vclpluginapi.h b/vcl/inc/vclpluginapi.h index 495c86b8e57b..589d7244ddaa 100644 --- a/vcl/inc/vclpluginapi.h +++ b/vcl/inc/vclpluginapi.h @@ -35,10 +35,10 @@ #define VCLPLUG_GTK_PUBLIC SAL_DLLPUBLIC_IMPORT #endif -#if defined VCLPLUG_KDE5_IMPLEMENTATION -#define VCLPLUG_KDE5_PUBLIC SAL_DLLPUBLIC_EXPORT +#if defined VCLPLUG_KF5_IMPLEMENTATION +#define VCLPLUG_KF5_PUBLIC SAL_DLLPUBLIC_EXPORT #else -#define VCLPLUG_KDE5_PUBLIC SAL_DLLPUBLIC_IMPORT +#define VCLPLUG_KF5_PUBLIC SAL_DLLPUBLIC_IMPORT #endif #if defined VCLPLUG_OSX_IMPLEMENTATION diff --git a/vcl/qa/cppunit/app/test_IconThemeSelector.cxx b/vcl/qa/cppunit/app/test_IconThemeSelector.cxx index 5ff3468655cc..cff9641cd033 100644 --- a/vcl/qa/cppunit/app/test_IconThemeSelector.cxx +++ b/vcl/qa/cppunit/app/test_IconThemeSelector.cxx @@ -75,8 +75,8 @@ IconThemeSelectorTest::BreezeIsReturnedForKde5Desktop() { std::vector themes = GetFakeInstalledThemes(); vcl::IconThemeSelector s; - OUString r = s.SelectIconThemeForDesktopEnvironment(themes, "kde5"); - CPPUNIT_ASSERT_EQUAL_MESSAGE("'breeze' theme is returned for kde5 desktop", OUString("breeze"), r); + OUString r = s.SelectIconThemeForDesktopEnvironment(themes, "plasma5"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("'breeze' theme is returned for Plasma 5 desktop", OUString("breeze"), r); } void diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx index 0bfd51c515da..142cb12aa199 100644 --- a/vcl/qt5/Qt5Frame.cxx +++ b/vcl/qt5/Qt5Frame.cxx @@ -1062,14 +1062,14 @@ KeyIndicatorState Qt5Frame::GetIndicatorState() { return KeyIndicatorState(); } void Qt5Frame::SimulateKeyPress(sal_uInt16 nKeyCode) { - SAL_WARN("vcl.kde5", "missing simulate keypress " << nKeyCode); + SAL_WARN("vcl.qt5", "missing simulate keypress " << nKeyCode); } void Qt5Frame::SetParent(SalFrame* pNewParent) { m_pParent = static_cast(pNewParent); } bool Qt5Frame::SetPluginParent(SystemParentData* /*pNewParent*/) { - //FIXME: no SetPluginParent impl. for kde5 + //FIXME: no SetPluginParent impl. for qt5 return false; } diff --git a/vcl/source/app/IconThemeSelector.cxx b/vcl/source/app/IconThemeSelector.cxx index 0ed454f2911b..ff2dcc52805a 100644 --- a/vcl/source/app/IconThemeSelector.cxx +++ b/vcl/source/app/IconThemeSelector.cxx @@ -55,7 +55,7 @@ IconThemeSelector::GetIconThemeForDesktopEnvironment(const OUString& desktopEnvi return OUString("colibre"); #else OUString r; - if ( desktopEnvironment.equalsIgnoreAsciiCase("kde5") || + if ( desktopEnvironment.equalsIgnoreAsciiCase("plasma5") || desktopEnvironment.equalsIgnoreAsciiCase("lxqt") ) { r = "breeze"; } diff --git a/vcl/source/app/salplug.cxx b/vcl/source/app/salplug.cxx index 4ec54849b21c..20604edb7f46 100644 --- a/vcl/source/app/salplug.cxx +++ b/vcl/source/app/salplug.cxx @@ -65,11 +65,14 @@ SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = false ) #endif SalInstance* pInst = nullptr; + OUString aUsedModuleBase(rModuleBase); + if (aUsedModuleBase == "kde5") + aUsedModuleBase = "kf5"; OUString aModule( #ifdef SAL_DLLPREFIX SAL_DLLPREFIX #endif - "vclplug_" + rModuleBase + "lo" SAL_DLLEXTENSION ); + "vclplug_" + aUsedModuleBase + "lo" SAL_DLLEXTENSION ); osl::Module aMod; if (aMod.loadRelative(reinterpret_cast(&tryInstance), aModule, SAL_LOADMODULE_GLOBAL)) @@ -92,7 +95,7 @@ SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = false ) * So make sure libgtk+ & co are still mapped into memory when * atk-bridge's atexit handler gets called. */ - if( rModuleBase == "gtk" || rModuleBase == "gtk3" || rModuleBase == "gtk3_kde5" || rModuleBase == "win" ) + if( aUsedModuleBase == "gtk" || aUsedModuleBase == "gtk3" || aUsedModuleBase == "gtk3_kde5" || aUsedModuleBase == "win" ) { pCloseModule = nullptr; } @@ -145,8 +148,8 @@ SalInstance* autodetect_plugin() { static const char* const pKDEFallbackList[] = { -#if ENABLE_KDE5 - "kde5", +#if ENABLE_KF5 + "kf5", #endif #if ENABLE_GTK3_KDE5 "gtk3_kde5", @@ -181,8 +184,7 @@ SalInstance* autodetect_plugin() desktop == DESKTOP_XFCE || desktop == DESKTOP_MATE ) pList = pStandardFallbackList; - else if( desktop == DESKTOP_KDE5 || - desktop == DESKTOP_LXQT ) + else if (desktop == DESKTOP_PLASMA5 || desktop == DESKTOP_LXQT) pList = pKDEFallbackList; SalInstance* pInst = nullptr; @@ -257,7 +259,7 @@ SalInstance *CreateSalInstance() #ifdef MACOSX "osx" #else - "gtk3", "gtk", "kde5", "gen" + "gtk3", "gtk", "kf5", "gen" #endif #endif }; @@ -314,7 +316,7 @@ const OUString& SalGetDesktopEnvironment() // Order to match desktops.hxx' DesktopType static const char * const desktop_strings[] = { "none", "unknown", "GNOME", "UNITY", - "XFCE", "MATE", "KDE5", "LXQT" }; + "XFCE", "MATE", "PLASMA5", "LXQT" }; static OUString aDesktopEnvironment; if( aDesktopEnvironment.isEmpty()) { diff --git a/vcl/unx/generic/desktopdetect/desktopdetector.cxx b/vcl/unx/generic/desktopdetect/desktopdetector.cxx index 2c453e051b5c..b2aea898e45c 100644 --- a/vcl/unx/generic/desktopdetect/desktopdetector.cxx +++ b/vcl/unx/generic/desktopdetect/desktopdetector.cxx @@ -115,15 +115,11 @@ static bool is_gnome_desktop( Display* pDisplay ) return ret; } - -static bool is_kde5_desktop() +static bool is_plasma5_desktop() { - static const char * pFullVersion = getenv( "KDE_FULL_SESSION" ); - static const char * pSessionVersion = getenv( "KDE_SESSION_VERSION" ); - if ( pFullVersion && pSessionVersion && strcmp(pSessionVersion, "5") == 0) - return true; - - return false; + static const char* pFullVersion = getenv("KDE_FULL_SESSION"); + static const char* pSessionVersion = getenv("KDE_SESSION_VERSION"); + return pFullVersion && pSessionVersion && (0 == strcmp(pSessionVersion, "5")); } extern "C" @@ -139,8 +135,8 @@ DESKTOP_DETECTOR_PUBLIC DesktopType get_desktop_environment() if ( aOver.equalsIgnoreAsciiCase( "lxqt" ) ) return DESKTOP_LXQT; - if ( aOver.equalsIgnoreAsciiCase( "kde5" ) ) - return DESKTOP_KDE5; + if (aOver.equalsIgnoreAsciiCase("plasma5") || aOver.equalsIgnoreAsciiCase("plasma")) + return DESKTOP_PLASMA5; if ( aOver.equalsIgnoreAsciiCase( "gnome" ) ) return DESKTOP_GNOME; if ( aOver.equalsIgnoreAsciiCase( "gnome-wayland" ) ) @@ -197,9 +193,8 @@ DESKTOP_DETECTOR_PUBLIC DesktopType get_desktop_environment() else if ( aDesktopSession.equalsIgnoreAsciiCase( "lxqt" ) ) return DESKTOP_LXQT; - - if ( is_kde5_desktop() ) - return DESKTOP_KDE5; + if (is_plasma5_desktop()) + return DESKTOP_PLASMA5; // tdf#121275 if we still can't tell, and WAYLAND_DISPLAY // is set, default to gtk3 diff --git a/vcl/unx/gtk3_kde5/kde5_filepicker.cxx b/vcl/unx/gtk3_kde5/kde5_filepicker.cxx index f4cb305e239c..2ee4dbd8e85c 100644 --- a/vcl/unx/gtk3_kde5/kde5_filepicker.cxx +++ b/vcl/unx/gtk3_kde5/kde5_filepicker.cxx @@ -68,7 +68,7 @@ void KDE5FilePicker::enableFolderMode() // and then confirming would return "foo" rather than "foo/bar"; // on the other hand, non-native file dialog needs 'QFileDialog::Directory' // and doesn't allow folder selection otherwise - if (Application::GetDesktopEnvironment() != "KDE5") + if (Application::GetDesktopEnvironment() != "PLASMA5") { _dialog->setFileMode(QFileDialog::Directory); } @@ -248,7 +248,7 @@ void KDE5FilePicker::setupCustomWidgets() // dialog there in order not to lose the custom controls and insert the custom // widget in the layout returned by QFileDialog::layout() // (which returns nullptr for native file dialogs) - if (Application::GetDesktopEnvironment() == "KDE5") + if (Application::GetDesktopEnvironment() == "PLASMA5") { qApp->installEventFilter(this); } diff --git a/vcl/unx/kde5/KDE5FilePicker.hxx b/vcl/unx/kde5/KDE5FilePicker.hxx deleted file mode 100644 index 786a99b00777..000000000000 --- a/vcl/unx/kde5/KDE5FilePicker.hxx +++ /dev/null @@ -1,65 +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 QGridLayout; - -class KDE5FilePicker : public Qt5FilePicker -{ - Q_OBJECT - -protected: - //layout for extra custom controls - QGridLayout* _layout; - - bool allowRemoteUrls; - -public: - explicit KDE5FilePicker(css::uno::Reference const& context, - QFileDialog::FileMode); - - // XExecutableDialog functions - virtual sal_Int16 SAL_CALL execute() 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; - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() override; - virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override; - virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() override; - -private: - //add a custom control widget to the file dialog - void addCustomControl(sal_Int16 controlId) override; - -protected: - bool eventFilter(QObject* watched, QEvent* event) override; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde5/KDE5FilePicker2.cxx b/vcl/unx/kde5/KDE5FilePicker2.cxx deleted file mode 100644 index cb778e2fd0f7..000000000000 --- a/vcl/unx/kde5/KDE5FilePicker2.cxx +++ /dev/null @@ -1,210 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "KDE5FilePicker.hxx" -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include - -using namespace ::com::sun::star; -using ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION; - -namespace -{ -uno::Sequence FilePicker_getSupportedServiceNames() -{ - 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; -} -} - -// KDE5FilePicker - -KDE5FilePicker::KDE5FilePicker(css::uno::Reference const& context, - QFileDialog::FileMode eMode) - // Native kde5 filepicker does not add file extension automatically - : Qt5FilePicker(context, eMode, true, true) - , _layout(new QGridLayout(m_pExtraControls)) - , allowRemoteUrls(false) -{ - // use native dialog - m_pFileDialog->setOption(QFileDialog::DontUseNativeDialog, false); - - // only columns 0 and 1 are used by controls (s. Qt5FilePicker::addCustomControl); - // set stretch for (unused) column 2 in order for the controls to only take the space - // they actually need and avoid empty space in between - _layout->setColumnStretch(2, 1); - - // set layout so custom widgets show up in our native file dialog - setCustomControlWidgetLayout(_layout); - - m_pFileDialog->setSupportedSchemes({ - QStringLiteral("file"), QStringLiteral("ftp"), QStringLiteral("http"), - QStringLiteral("https"), QStringLiteral("webdav"), QStringLiteral("webdavs"), - QStringLiteral("smb"), - QStringLiteral(""), // this makes removable devices shown - }); - - // used to set the custom controls - qApp->installEventFilter(this); -} - -sal_Int16 SAL_CALL KDE5FilePicker::execute() -{ - SolarMutexGuard g; - auto* pSalInst(static_cast(GetSalData()->m_pInstance)); - assert(pSalInst); - if (!pSalInst->IsMainThread()) - { - sal_Int16 ret; - pSalInst->RunInMainThread([&ret, this] { ret = execute(); }); - return ret; - } - - if (!m_aNamedFilterList.isEmpty()) - m_pFileDialog->setNameFilters(m_aNamedFilterList); - if (!m_aCurrentFilter.isEmpty()) - m_pFileDialog->selectNameFilter(m_aCurrentFilter); - - m_pFileDialog->show(); - //block and wait for user input - return m_pFileDialog->exec() == QFileDialog::Accepted ? 1 : 0; -} - -// XFilePickerControlAccess -void SAL_CALL KDE5FilePicker::setValue(sal_Int16 controlId, sal_Int16 nControlAction, - const uno::Any& value) -{ - if (CHECKBOX_AUTOEXTENSION == controlId) - // We ignore this one and rely on QFileDialog to provide the functionality - return; - - Qt5FilePicker::setValue(controlId, nControlAction, value); -} - -uno::Any SAL_CALL KDE5FilePicker::getValue(sal_Int16 controlId, sal_Int16 nControlAction) -{ - SolarMutexGuard g; - auto* pSalInst(static_cast(GetSalData()->m_pInstance)); - assert(pSalInst); - if (!pSalInst->IsMainThread()) - { - uno::Any ret; - pSalInst->RunInMainThread([&ret, this, controlId, nControlAction]() { - ret = getValue(controlId, nControlAction); - }); - return ret; - } - - if (CHECKBOX_AUTOEXTENSION == controlId) - // We ignore this one and rely on QFileDialog 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 QFileDialog's handling of it. QFileDialog also - // saves the value of the setting, so LO core is not needed for that either. - return uno::Any(false); - - return Qt5FilePicker::getValue(controlId, nControlAction); -} - -void SAL_CALL KDE5FilePicker::enableControl(sal_Int16 controlId, sal_Bool enable) -{ - if (CHECKBOX_AUTOEXTENSION == controlId) - // We ignore this one and rely on QFileDialog to provide the functionality - return; - - Qt5FilePicker::enableControl(controlId, enable); -} - -void SAL_CALL KDE5FilePicker::setLabel(sal_Int16 controlId, const OUString& label) -{ - if (CHECKBOX_AUTOEXTENSION == controlId) - // We ignore this one and rely on QFileDialog to provide the functionality - return; - - Qt5FilePicker::setLabel(controlId, label); -} - -OUString SAL_CALL KDE5FilePicker::getLabel(sal_Int16 controlId) -{ - // We ignore this one and rely on QFileDialog to provide the functionality - if (CHECKBOX_AUTOEXTENSION == controlId) - return ""; - - return Qt5FilePicker::getLabel(controlId); -} - -void KDE5FilePicker::addCustomControl(sal_Int16 controlId) -{ - // native kde5 filepicker has its own autoextension checkbox, - // therefore avoid adding yet another one - if (controlId == CHECKBOX_AUTOEXTENSION) - return; - - Qt5FilePicker::addCustomControl(controlId); -} - -// XServiceInfo -OUString SAL_CALL KDE5FilePicker::getImplementationName() -{ - return OUString("com.sun.star.ui.dialogs.KDE5FilePicker"); -} - -sal_Bool SAL_CALL KDE5FilePicker::supportsService(const OUString& ServiceName) -{ - return cppu::supportsService(this, ServiceName); -} - -uno::Sequence SAL_CALL KDE5FilePicker::getSupportedServiceNames() -{ - return FilePicker_getSupportedServiceNames(); -} - -bool KDE5FilePicker::eventFilter(QObject* o, QEvent* e) -{ - if (e->type() == QEvent::Show && o->isWidgetType()) - { - auto* w = static_cast(o); - if (!w->parentWidget() && w->isModal()) - { - if (auto* fileWidget = w->findChild({}, Qt::FindDirectChildrenOnly)) - { - fileWidget->setCustomWidget(m_pExtraControls); - // remove event filter again; the only purpose was to set the custom widget here - qApp->removeEventFilter(this); - } - } - } - return QObject::eventFilter(o, e); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx deleted file mode 100644 index efb08a74d832..000000000000 --- a/vcl/unx/kde5/KDE5SalFrame.cxx +++ /dev/null @@ -1,222 +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 "KDE5SalFrame.hxx" - -#include - -#include -#include -#include - -#include - -#include - -#include - -KDE5SalFrame::KDE5SalFrame(KDE5SalFrame* pParent, SalFrameStyleFlags nState, bool bUseCairo) - : Qt5Frame(pParent, nState, bUseCairo) - , m_bGraphicsInUse(false) -{ -} - -/** 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 == 0) // QFont::AnyStretch since Qt 5.8 - aInfo.m_eWidth = WIDTH_DONTKNOW; - else 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.kde5", "font name BEFORE system match: \"" << aInfo.m_aFamilyName << "\""); - - // match font to e.g. resolve "Sans" - psp::PrintFontManager::get().matchFont(aInfo, rLocale); - - SAL_INFO("vcl.kde5", "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 KDE5SalFrame::UpdateSettings(AllSettings& rSettings) -{ - Qt5Frame::UpdateSettings(rSettings); - - StyleSettings style(rSettings.GetStyleSettings()); - bool bSetTitleFont = false; - - // 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 aFont = toFont(aWMGroup.readEntry(pKey, QFont()), - rSettings.GetUILanguageTag().getLocale()); - style.SetTitleFont( aFont ); - 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 aFont = toFont(aIconsGroup.readEntry(pKey, QFont()), - rSettings.GetUILanguageTag().getLocale()); - style.SetToolFont( aFont ); - } - }*/ - - // 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())); - - int flash_time = QApplication::cursorFlashTime(); - style.SetCursorBlinkTime(flash_time != 0 ? flash_time / 2 : STYLE_CURSOR_NOBLINKTIME); - - // Menu - std::unique_ptr pMenuBar = std::make_unique(); - aFont = toFont(pMenuBar->font(), rSettings.GetUILanguageTag().getLocale()); - style.SetMenuFont(aFont); - - rSettings.SetStyleSettings(style); -} - -SalGraphics* KDE5SalFrame::AcquireGraphics() -{ - if (m_bGraphicsInUse) - return nullptr; - - m_bGraphicsInUse = true; - - if (!m_pKDE5Graphics.get()) - { - m_pKDE5Graphics.reset(new Qt5SvpGraphics(this)); - Qt5Frame::InitQt5SvpGraphics(m_pKDE5Graphics.get()); - } - - return m_pKDE5Graphics.get(); -} - -void KDE5SalFrame::ReleaseGraphics(SalGraphics* pSalGraph) -{ - (void)pSalGraph; - assert(pSalGraph == m_pKDE5Graphics.get()); - m_bGraphicsInUse = false; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde5/KDE5SalFrame.hxx b/vcl/unx/kde5/KDE5SalFrame.hxx deleted file mode 100644 index cf3874af7c8c..000000000000 --- a/vcl/unx/kde5/KDE5SalFrame.hxx +++ /dev/null @@ -1,47 +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 - -class QWidget; - -class KDE5SalFrame : public Qt5Frame -{ -private: - std::unique_ptr m_pKDE5Graphics; - bool m_bGraphicsInUse; - -public: - KDE5SalFrame(KDE5SalFrame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo); - - virtual SalGraphics* AcquireGraphics() override; - virtual void ReleaseGraphics(SalGraphics* pGraphics) override; - virtual void UpdateSettings(AllSettings& rSettings) override; - - virtual LanguageType GetInputLanguage() override { return LANGUAGE_SYSTEM; } - virtual SalPointerState GetPointerState() override { return SalPointerState(); } - virtual KeyIndicatorState GetIndicatorState() override { return KeyIndicatorState(); } -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde5/KDE5SalInstance.cxx b/vcl/unx/kde5/KDE5SalInstance.cxx deleted file mode 100644 index b1b8eb59375f..000000000000 --- a/vcl/unx/kde5/KDE5SalInstance.cxx +++ /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 . - */ - -#include - -#include - -#include - -#include - -#include - -#include "KDE5FilePicker.hxx" -#include "KDE5SalFrame.hxx" -#include "KDE5SalInstance.hxx" - -using namespace com::sun::star; - -KDE5SalInstance::KDE5SalInstance(std::unique_ptr& pQApp) - : Qt5Instance(pQApp, true) -{ - ImplSVData* pSVData = ImplGetSVData(); - pSVData->maAppData.mxToolkitName = OUString("kde5"); -} - -SalFrame* KDE5SalInstance::CreateFrame(SalFrame* pParent, SalFrameStyleFlags nState) -{ - SalFrame* pRet(nullptr); - RunInMainThread(std::function([&pRet, pParent, nState]() { - pRet = new KDE5SalFrame(static_cast(pParent), nState, true); - })); - assert(pRet); - return pRet; -} - -bool KDE5SalInstance::hasNativeFileSelection() const -{ - if (Application::GetDesktopEnvironment() == "KDE5") - return true; - return Qt5Instance::hasNativeFileSelection(); -} - -Qt5FilePicker* -KDE5SalInstance::createPicker(css::uno::Reference const& context, - QFileDialog::FileMode eMode) -{ - if (!IsMainThread()) - { - SolarMutexGuard g; - Qt5FilePicker* pPicker; - RunInMainThread(std::function([&, this]() { pPicker = createPicker(context, eMode); })); - assert(pPicker); - return pPicker; - } - - // In order to insert custom controls, KDE5FilePicker currently relies on KFileWidget - // being used in the native file picker, which is only the case for KDE Plasma. - // Therefore, return the plain qt5 one in order to not lose custom controls. - if (Application::GetDesktopEnvironment() == "KDE5") - return new KDE5FilePicker(context, eMode); - return Qt5Instance::createPicker(context, eMode); -} - -extern "C" { -VCLPLUG_KDE5_PUBLIC SalInstance* create_SalInstance() -{ - std::unique_ptr pFakeArgv; - std::unique_ptr pFakeArgc; - std::vector aFakeArgvFreeable; - Qt5Instance::AllocFakeCmdlineArgs(pFakeArgv, pFakeArgc, aFakeArgvFreeable); - - std::unique_ptr pQApp - = Qt5Instance::CreateQApplication(*pFakeArgc, pFakeArgv.get()); - - KDE5SalInstance* pInstance = new KDE5SalInstance(pQApp); - pInstance->MoveFakeCmdlineArgs(pFakeArgv, pFakeArgc, aFakeArgvFreeable); - - new Qt5Data(pInstance); - - return pInstance; -} -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde5/KDE5SalInstance.hxx b/vcl/unx/kde5/KDE5SalInstance.hxx deleted file mode 100644 index 4215ec483308..000000000000 --- a/vcl/unx/kde5/KDE5SalInstance.hxx +++ /dev/null @@ -1,36 +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 KDE5SalInstance final : public Qt5Instance -{ - bool hasNativeFileSelection() const override; - Qt5FilePicker* createPicker(css::uno::Reference const& context, - QFileDialog::FileMode) override; - - SalFrame* CreateFrame(SalFrame* pParent, SalFrameStyleFlags nStyle) override; - -public: - explicit KDE5SalInstance(std::unique_ptr& pQApp); -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/KF5FilePicker.cxx b/vcl/unx/kf5/KF5FilePicker.cxx new file mode 100644 index 000000000000..366ca89ffa54 --- /dev/null +++ b/vcl/unx/kf5/KF5FilePicker.cxx @@ -0,0 +1,210 @@ +/* -*- 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 "KF5FilePicker.hxx" +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include + +using namespace ::com::sun::star; +using ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION; + +namespace +{ +uno::Sequence FilePicker_getSupportedServiceNames() +{ + 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.KF5FilePicker"; + aRet[3] = "com.sun.star.ui.dialogs.KF5FolderPicker"; + return aRet; +} +} + +// KF5FilePicker + +KF5FilePicker::KF5FilePicker(css::uno::Reference const& context, + QFileDialog::FileMode eMode) + // Native kf5 filepicker does not add file extension automatically + : Qt5FilePicker(context, eMode, true, true) + , _layout(new QGridLayout(m_pExtraControls)) + , allowRemoteUrls(false) +{ + // use native dialog + m_pFileDialog->setOption(QFileDialog::DontUseNativeDialog, false); + + // only columns 0 and 1 are used by controls (s. Qt5FilePicker::addCustomControl); + // set stretch for (unused) column 2 in order for the controls to only take the space + // they actually need and avoid empty space in between + _layout->setColumnStretch(2, 1); + + // set layout so custom widgets show up in our native file dialog + setCustomControlWidgetLayout(_layout); + + m_pFileDialog->setSupportedSchemes({ + QStringLiteral("file"), QStringLiteral("ftp"), QStringLiteral("http"), + QStringLiteral("https"), QStringLiteral("webdav"), QStringLiteral("webdavs"), + QStringLiteral("smb"), + QStringLiteral(""), // this makes removable devices shown + }); + + // used to set the custom controls + qApp->installEventFilter(this); +} + +sal_Int16 SAL_CALL KF5FilePicker::execute() +{ + SolarMutexGuard g; + auto* pSalInst(static_cast(GetSalData()->m_pInstance)); + assert(pSalInst); + if (!pSalInst->IsMainThread()) + { + sal_Int16 ret; + pSalInst->RunInMainThread([&ret, this] { ret = execute(); }); + return ret; + } + + if (!m_aNamedFilterList.isEmpty()) + m_pFileDialog->setNameFilters(m_aNamedFilterList); + if (!m_aCurrentFilter.isEmpty()) + m_pFileDialog->selectNameFilter(m_aCurrentFilter); + + m_pFileDialog->show(); + //block and wait for user input + return m_pFileDialog->exec() == QFileDialog::Accepted ? 1 : 0; +} + +// XFilePickerControlAccess +void SAL_CALL KF5FilePicker::setValue(sal_Int16 controlId, sal_Int16 nControlAction, + const uno::Any& value) +{ + if (CHECKBOX_AUTOEXTENSION == controlId) + // We ignore this one and rely on QFileDialog to provide the functionality + return; + + Qt5FilePicker::setValue(controlId, nControlAction, value); +} + +uno::Any SAL_CALL KF5FilePicker::getValue(sal_Int16 controlId, sal_Int16 nControlAction) +{ + SolarMutexGuard g; + auto* pSalInst(static_cast(GetSalData()->m_pInstance)); + assert(pSalInst); + if (!pSalInst->IsMainThread()) + { + uno::Any ret; + pSalInst->RunInMainThread([&ret, this, controlId, nControlAction]() { + ret = getValue(controlId, nControlAction); + }); + return ret; + } + + if (CHECKBOX_AUTOEXTENSION == controlId) + // We ignore this one and rely on QFileDialog 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 QFileDialog's handling of it. QFileDialog also + // saves the value of the setting, so LO core is not needed for that either. + return uno::Any(false); + + return Qt5FilePicker::getValue(controlId, nControlAction); +} + +void SAL_CALL KF5FilePicker::enableControl(sal_Int16 controlId, sal_Bool enable) +{ + if (CHECKBOX_AUTOEXTENSION == controlId) + // We ignore this one and rely on QFileDialog to provide the functionality + return; + + Qt5FilePicker::enableControl(controlId, enable); +} + +void SAL_CALL KF5FilePicker::setLabel(sal_Int16 controlId, const OUString& label) +{ + if (CHECKBOX_AUTOEXTENSION == controlId) + // We ignore this one and rely on QFileDialog to provide the functionality + return; + + Qt5FilePicker::setLabel(controlId, label); +} + +OUString SAL_CALL KF5FilePicker::getLabel(sal_Int16 controlId) +{ + // We ignore this one and rely on QFileDialog to provide the functionality + if (CHECKBOX_AUTOEXTENSION == controlId) + return ""; + + return Qt5FilePicker::getLabel(controlId); +} + +void KF5FilePicker::addCustomControl(sal_Int16 controlId) +{ + // native kf5 filepicker has its own autoextension checkbox, + // therefore avoid adding yet another one + if (controlId == CHECKBOX_AUTOEXTENSION) + return; + + Qt5FilePicker::addCustomControl(controlId); +} + +// XServiceInfo +OUString SAL_CALL KF5FilePicker::getImplementationName() +{ + return OUString("com.sun.star.ui.dialogs.KF5FilePicker"); +} + +sal_Bool SAL_CALL KF5FilePicker::supportsService(const OUString& ServiceName) +{ + return cppu::supportsService(this, ServiceName); +} + +uno::Sequence SAL_CALL KF5FilePicker::getSupportedServiceNames() +{ + return FilePicker_getSupportedServiceNames(); +} + +bool KF5FilePicker::eventFilter(QObject* o, QEvent* e) +{ + if (e->type() == QEvent::Show && o->isWidgetType()) + { + auto* w = static_cast(o); + if (!w->parentWidget() && w->isModal()) + { + if (auto* fileWidget = w->findChild({}, Qt::FindDirectChildrenOnly)) + { + fileWidget->setCustomWidget(m_pExtraControls); + // remove event filter again; the only purpose was to set the custom widget here + qApp->removeEventFilter(this); + } + } + } + return QObject::eventFilter(o, e); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/KF5FilePicker.hxx b/vcl/unx/kf5/KF5FilePicker.hxx new file mode 100644 index 000000000000..6bfc7ee96077 --- /dev/null +++ b/vcl/unx/kf5/KF5FilePicker.hxx @@ -0,0 +1,65 @@ +/* -*- 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 QGridLayout; + +class KF5FilePicker : public Qt5FilePicker +{ + Q_OBJECT + +protected: + //layout for extra custom controls + QGridLayout* _layout; + + bool allowRemoteUrls; + +public: + explicit KF5FilePicker(css::uno::Reference const& context, + QFileDialog::FileMode); + + // XExecutableDialog functions + virtual sal_Int16 SAL_CALL execute() 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; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override; + virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() override; + +private: + //add a custom control widget to the file dialog + void addCustomControl(sal_Int16 controlId) override; + +protected: + bool eventFilter(QObject* watched, QEvent* event) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/KF5SalFrame.cxx b/vcl/unx/kf5/KF5SalFrame.cxx new file mode 100644 index 000000000000..a212759aeb91 --- /dev/null +++ b/vcl/unx/kf5/KF5SalFrame.cxx @@ -0,0 +1,222 @@ +/* -*- 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 "KF5SalFrame.hxx" + +#include + +#include +#include +#include + +#include + +#include + +#include + +KF5SalFrame::KF5SalFrame(KF5SalFrame* pParent, SalFrameStyleFlags nState, bool bUseCairo) + : Qt5Frame(pParent, nState, bUseCairo) + , m_bGraphicsInUse(false) +{ +} + +/** 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 == 0) // QFont::AnyStretch since Qt 5.8 + aInfo.m_eWidth = WIDTH_DONTKNOW; + else 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.kf5", "font name BEFORE system match: \"" << aInfo.m_aFamilyName << "\""); + + // match font to e.g. resolve "Sans" + psp::PrintFontManager::get().matchFont(aInfo, rLocale); + + SAL_INFO("vcl.kf5", "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 KF5SalFrame::UpdateSettings(AllSettings& rSettings) +{ + Qt5Frame::UpdateSettings(rSettings); + + StyleSettings style(rSettings.GetStyleSettings()); + bool bSetTitleFont = false; + + // 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 aFont = toFont(aWMGroup.readEntry(pKey, QFont()), + rSettings.GetUILanguageTag().getLocale()); + style.SetTitleFont( aFont ); + 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 aFont = toFont(aIconsGroup.readEntry(pKey, QFont()), + rSettings.GetUILanguageTag().getLocale()); + style.SetToolFont( aFont ); + } + }*/ + + // 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())); + + int flash_time = QApplication::cursorFlashTime(); + style.SetCursorBlinkTime(flash_time != 0 ? flash_time / 2 : STYLE_CURSOR_NOBLINKTIME); + + // Menu + std::unique_ptr pMenuBar = std::make_unique(); + aFont = toFont(pMenuBar->font(), rSettings.GetUILanguageTag().getLocale()); + style.SetMenuFont(aFont); + + rSettings.SetStyleSettings(style); +} + +SalGraphics* KF5SalFrame::AcquireGraphics() +{ + if (m_bGraphicsInUse) + return nullptr; + + m_bGraphicsInUse = true; + + if (!m_pKF5Graphics.get()) + { + m_pKF5Graphics.reset(new Qt5SvpGraphics(this)); + Qt5Frame::InitQt5SvpGraphics(m_pKF5Graphics.get()); + } + + return m_pKF5Graphics.get(); +} + +void KF5SalFrame::ReleaseGraphics(SalGraphics* pSalGraph) +{ + (void)pSalGraph; + assert(pSalGraph == m_pKF5Graphics.get()); + m_bGraphicsInUse = false; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/KF5SalFrame.hxx b/vcl/unx/kf5/KF5SalFrame.hxx new file mode 100644 index 000000000000..091a5b019ca7 --- /dev/null +++ b/vcl/unx/kf5/KF5SalFrame.hxx @@ -0,0 +1,47 @@ +/* -*- 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 + +class QWidget; + +class KF5SalFrame : public Qt5Frame +{ +private: + std::unique_ptr m_pKF5Graphics; + bool m_bGraphicsInUse; + +public: + KF5SalFrame(KF5SalFrame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo); + + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics(SalGraphics* pGraphics) override; + virtual void UpdateSettings(AllSettings& rSettings) override; + + virtual LanguageType GetInputLanguage() override { return LANGUAGE_SYSTEM; } + virtual SalPointerState GetPointerState() override { return SalPointerState(); } + virtual KeyIndicatorState GetIndicatorState() override { return KeyIndicatorState(); } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/KF5SalInstance.cxx b/vcl/unx/kf5/KF5SalInstance.cxx new file mode 100644 index 000000000000..da4906a70a49 --- /dev/null +++ b/vcl/unx/kf5/KF5SalInstance.cxx @@ -0,0 +1,101 @@ +/* -*- 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 "KF5FilePicker.hxx" +#include "KF5SalFrame.hxx" +#include "KF5SalInstance.hxx" + +using namespace com::sun::star; + +KF5SalInstance::KF5SalInstance(std::unique_ptr& pQApp) + : Qt5Instance(pQApp, true) +{ + ImplSVData* pSVData = ImplGetSVData(); + pSVData->maAppData.mxToolkitName = OUString("kf5"); +} + +SalFrame* KF5SalInstance::CreateFrame(SalFrame* pParent, SalFrameStyleFlags nState) +{ + SalFrame* pRet(nullptr); + RunInMainThread(std::function([&pRet, pParent, nState]() { + pRet = new KF5SalFrame(static_cast(pParent), nState, true); + })); + assert(pRet); + return pRet; +} + +bool KF5SalInstance::hasNativeFileSelection() const +{ + if (Application::GetDesktopEnvironment() == "PLASMA5") + return true; + return Qt5Instance::hasNativeFileSelection(); +} + +Qt5FilePicker* +KF5SalInstance::createPicker(css::uno::Reference const& context, + QFileDialog::FileMode eMode) +{ + if (!IsMainThread()) + { + SolarMutexGuard g; + Qt5FilePicker* pPicker; + RunInMainThread(std::function([&, this]() { pPicker = createPicker(context, eMode); })); + assert(pPicker); + return pPicker; + } + + // In order to insert custom controls, KF5FilePicker currently relies on KFileWidget + // being used in the native file picker, which is only the case for KDE Plasma. + // Therefore, return the plain qt5 one in order to not lose custom controls. + if (Application::GetDesktopEnvironment() == "PLASMA5") + return new KF5FilePicker(context, eMode); + return Qt5Instance::createPicker(context, eMode); +} + +extern "C" { +VCLPLUG_KF5_PUBLIC SalInstance* create_SalInstance() +{ + std::unique_ptr pFakeArgv; + std::unique_ptr pFakeArgc; + std::vector aFakeArgvFreeable; + Qt5Instance::AllocFakeCmdlineArgs(pFakeArgv, pFakeArgc, aFakeArgvFreeable); + + std::unique_ptr pQApp + = Qt5Instance::CreateQApplication(*pFakeArgc, pFakeArgv.get()); + + KF5SalInstance* pInstance = new KF5SalInstance(pQApp); + pInstance->MoveFakeCmdlineArgs(pFakeArgv, pFakeArgc, aFakeArgvFreeable); + + new Qt5Data(pInstance); + + return pInstance; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/KF5SalInstance.hxx b/vcl/unx/kf5/KF5SalInstance.hxx new file mode 100644 index 000000000000..5dd306da5231 --- /dev/null +++ b/vcl/unx/kf5/KF5SalInstance.hxx @@ -0,0 +1,36 @@ +/* -*- 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 KF5SalInstance final : public Qt5Instance +{ + bool hasNativeFileSelection() const override; + Qt5FilePicker* createPicker(css::uno::Reference const& context, + QFileDialog::FileMode) override; + + SalFrame* CreateFrame(SalFrame* pParent, SalFrameStyleFlags nStyle) override; + +public: + explicit KF5SalInstance(std::unique_ptr& pQApp); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit