configure.ac | 4 ++ vcl/unx/gtk3_kde5/kde5_filepicker.cxx | 45 ++++++------------------------ vcl/unx/gtk3_kde5/kde5_filepicker.hxx | 3 -- vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx | 27 ++++++++++++++---- 4 files changed, 35 insertions(+), 44 deletions(-)
New commits: commit f1b60bd62daff4aaf6465caadd4ad0c447521102 Author: Milian Wolff <milian.wo...@kdab.com> Date: Mon Jan 22 17:06:00 2018 +0100 Support opening of (some) remote URLs through the KDE file dialog LO already supports http, https, webdav and webdavs through the WebDAVContentProvider. Ftp is supported via FTPContentProvider and then finally we have the GIOContentProvider that can potentially support SMB, if the dependencies for that are met. We now configure the KDE file dialog to allow these remote protocols. Note that this filtering depends on https://phabricator.kde.org/D10024 and https://phabricator.kde.org/D10025 to have any effect. Then we rewrite the URLs we receive from KIO to a format that is supported by LO. Most notably, we prepend `vnd.sun.star.` to the webdav URL schemes, such that they get picked up by the WebDAVContentProvider. Then finally, we clear the username from the smb:// URLs we get from KIO, as that prevents GIO from opening them. In all cases, the user will get prompted a second time for the credentials required to access the remote resource. This is unfortunate, but better than nothing. In the future, we may solve this issue through either a separate KIO UCP or by getting support for the FDO Secret Service specification in KWallet. Change-Id: I91df28434b115639c2698968e2a672b3320bf8e2 Reviewed-on: https://gerrit.libreoffice.org/48350 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/vcl/unx/gtk3_kde5/kde5_filepicker.cxx b/vcl/unx/gtk3_kde5/kde5_filepicker.cxx index db7d04cf7d4a..456ba645808b 100644 --- a/vcl/unx/gtk3_kde5/kde5_filepicker.cxx +++ b/vcl/unx/gtk3_kde5/kde5_filepicker.cxx @@ -32,17 +32,6 @@ #include <QtWidgets/QWidget> #include <QtWidgets/QApplication> -// The dialog should check whether LO also supports the protocol -// provided by KIO, and KFileWidget::dirOperator() is only 4.3+ . -// Moreover it's only in this somewhat internal KFileWidget class, -// which may not necessarily be what QFileDialog::fileWidget() returns, -// but that's hopefully not a problem in practice. -//#if Qt_VERSION_MAJOR == 4 && Qt_VERSION_MINOR >= 2 -//#define ALLOW_REMOTE_URLS 1 -//#else -#define ALLOW_REMOTE_URLS 0 -//#endif - // KDE5FilePicker KDE5FilePicker::KDE5FilePicker(QObject* parent) @@ -53,16 +42,15 @@ KDE5FilePicker::KDE5FilePicker(QObject* parent) , _winId(0) , allowRemoteUrls(false) { -#if ALLOW_REMOTE_URLS - if (KFileWidget* fileWidget = dynamic_cast<KFileWidget*>(_dialog->fileWidget())) - { - allowRemoteUrls = true; - // Use finishedLoading signal rather than e.g. urlEntered, because if there's a problem - // such as the URL being mistyped, there's no way to prevent two message boxes about it, - // one from us and one from Qt code. - connect(fileWidget->dirOperator(), SIGNAL(finishedLoading()), SLOT(checkProtocol())); - } -#endif + _dialog->setSupportedSchemes({ + QStringLiteral("file"), + QStringLiteral("ftp"), + QStringLiteral("http"), + QStringLiteral("https"), + QStringLiteral("webdav"), + QStringLiteral("webdavs"), + QStringLiteral("smb"), + }); setMultiSelectionMode(false); @@ -245,21 +233,6 @@ void SAL_CALL KDE5FilePicker::initialize(bool saveDialog) } } -void KDE5FilePicker::checkProtocol() -{ - // There's no libreoffice.desktop :(, so find a matching one. - /* - KService::List services = KServiceTypeTrader::self()->query( "Application", "Exec =~ 'libreoffice %U'" ); - QStringList protocols; - if( !services.isEmpty()) - protocols = services[ 0 ]->property( "X-Qt-Protocols" ).toStringList(); - if( protocols.isEmpty()) // incorrect (developer?) installation ? - protocols << "file" << "http"; - if( !protocols.contains( _dialog->baseUrl().protocol()) && !protocols.contains( "KIO" )) - KMessageBox::error( _dialog, KIO::buildErrorString( KIO::ERR_UNSUPPORTED_PROTOCOL, _dialog->baseUrl().protocol())); -*/ -} - void KDE5FilePicker::setWinId(sal_uIntPtr winId) { _winId = winId; } bool KDE5FilePicker::eventFilter(QObject* o, QEvent* e) diff --git a/vcl/unx/gtk3_kde5/kde5_filepicker.hxx b/vcl/unx/gtk3_kde5/kde5_filepicker.hxx index 8b364832c6af..25c7454f86b5 100644 --- a/vcl/unx/gtk3_kde5/kde5_filepicker.hxx +++ b/vcl/unx/gtk3_kde5/kde5_filepicker.hxx @@ -102,9 +102,6 @@ private: protected: bool eventFilter(QObject* watched, QEvent* event) override; -private Q_SLOTS: - void checkProtocol(); - Q_SIGNALS: void filterChanged(); void selectionChanged(); diff --git a/vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx b/vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx index 9911219d010a..1ae6289677d6 100644 --- a/vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx +++ b/vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx @@ -44,12 +44,12 @@ void sendIpcArg(std::ostream& stream, const QString& string) sendIpcStringArg(stream, utf8.size(), utf8.data()); } -void sendIpcArg(std::ostream& stream, const QList<QUrl>& urls) +void sendIpcArg(std::ostream& stream, const QStringList& list) { - stream << static_cast<uint32_t>(urls.size()) << ' '; - for (const auto& url : urls) + stream << static_cast<uint32_t>(list.size()) << ' '; + for (const auto& entry : list) { - sendIpcArg(stream, url.toString()); + sendIpcArg(stream, entry); } } @@ -126,7 +126,24 @@ void FilePickerIpc::readCommand() } case Commands::GetSelectedFiles: { - sendIpcArgs(std::cout, messageId, m_filePicker->getSelectedFiles()); + QStringList files; + for (auto url : m_filePicker->getSelectedFiles()) + { + if (url.scheme() == QLatin1String("webdav") + || url.scheme() == QLatin1String("webdavs")) + { + // translate webdav and webdavs URLs into a format supported by LO + url.setScheme(QLatin1String("vnd.sun.star.") + url.scheme()); + } + else if (url.scheme() == QLatin1String("smb")) + { + // clear the user name - the GIO backend does not support this apparently + // when no username is available, it will ask for the password + url.setUserName({}); + } + files << url.toString(); + } + sendIpcArgs(std::cout, messageId, files); return; } case Commands::AppendFilter: commit c7a1320593191e8359aa64d8e262948da085d358 Author: Rene Engelhard <r...@debian.org> Date: Sat Jan 13 16:02:52 2018 +0000 check for boost/process/child.hpp in configure.ac if --enable-gtk3-kde5 Change-Id: Idcd2931415558b41f94eb12a01f350f1ab53d134 Reviewed-on: https://gerrit.libreoffice.org/48319 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/configure.ac b/configure.ac index 80ec735478a6..6edc010762de 100644 --- a/configure.ac +++ b/configure.ac @@ -8706,6 +8706,10 @@ if test "$with_system_boost" = "yes"; then [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], []) AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [], [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], []) +if test "x$enable_gtk3_kde5" = "xyes"; then + AC_CHECK_HEADER(boost/process/child.hpp, [], + [AC_MSG_ERROR(boost/process/child.hpp not found. install boost >= 1.64)], []) +fi CXXFLAGS=$save_CXXFLAGS AC_LANG_POP([C++]) # this is in m4/ax_boost_base.m4 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits