diff --git a/cmake/modules/FindDiscount.cmake b/cmake/modules/FindDiscount.cmake index d09524ab..a08fb2d8 100644 --- a/cmake/modules/FindDiscount.cmake +++ b/cmake/modules/FindDiscount.cmake @@ -1,41 +1,41 @@ # - Find Discount # Find the discount markdown library. # # This module defines # discount_FOUND - whether the discount library was found # discount_LIBRARIES - the discount library # discount_INCLUDE_DIR - the include path of the discount library # Copyright (c) 2017, Julian Wolff, # Copyright (c) 2018, Sune Vuorela, -# Copyright (c) 2018, Laurent Montel, +# Copyright (c) 2018-2019, Laurent Montel, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (discount_INCLUDE_DIRS AND discount_LIBRARIES) # Already in cache set (discount_FOUND TRUE) else () find_library (discount_LIBRARY NAMES markdown libmarkdown ) find_path (discount_INCLUDE_DIR NAMES mkdio.h ) set(discount_LIBRARIES ${discount_LIBRARY}) set(discount_INCLUDE_DIRS ${discount_INCLUDE_DIR}) include (FindPackageHandleStandardArgs) find_package_handle_standard_args (discount DEFAULT_MSG discount_LIBRARIES discount_INCLUDE_DIR) endif() mark_as_advanced(discount_INCLUDE_DIRS discount_LIBRARIES) if (discount_FOUND) add_library(discount::Lib UNKNOWN IMPORTED) set_target_properties(discount::Lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${discount_INCLUDE_DIRS} IMPORTED_LOCATION ${discount_LIBRARIES}) endif() diff --git a/kmail/editorconvertertextplugins/markdown/markdownenginepage.cpp b/kmail/editorconvertertextplugins/markdown/markdownenginepage.cpp index da1696a7..f8c4b132 100644 --- a/kmail/editorconvertertextplugins/markdown/markdownenginepage.cpp +++ b/kmail/editorconvertertextplugins/markdown/markdownenginepage.cpp @@ -1,72 +1,72 @@ /* - Copyright (C) 2018 Laurent Montel + Copyright (C) 2018-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "markdownenginepage.h" #include #include MarkdownEnginePage::MarkdownEnginePage(QObject *parent) : QWebEnginePage(parent) { settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, false); settings()->setAttribute(QWebEngineSettings::PluginsEnabled, false); settings()->setAttribute(QWebEngineSettings::AutoLoadImages, true); settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, false); settings()->setAttribute(QWebEngineSettings::JavascriptCanAccessClipboard, false); settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, false); settings()->setAttribute(QWebEngineSettings::XSSAuditingEnabled, false); settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false); settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, false); settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls, false); settings()->setAttribute(QWebEngineSettings::ScreenCaptureEnabled, false); settings()->setAttribute(QWebEngineSettings::WebGLEnabled, false); settings()->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false); settings()->setAttribute(QWebEngineSettings::Accelerated2dCanvasEnabled, false); settings()->setAttribute(QWebEngineSettings::WebGLEnabled, false); settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false); settings()->setAttribute(QWebEngineSettings::AllowRunningInsecureContent, false); // FreeBSD actually ships QtWebengine 5.9 with Qt 5.10/5.11, so these enums do not exist there #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) && !defined(Q_OS_FREEBSD) settings()->setAttribute(QWebEngineSettings::ShowScrollBars, true); settings()->setAttribute(QWebEngineSettings::AllowWindowActivationFromJavaScript, false); #endif #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) && !defined(Q_OS_FREEBSD) settings()->setAttribute(QWebEngineSettings::PlaybackRequiresUserGesture, false); settings()->setAttribute(QWebEngineSettings::JavascriptCanPaste, false); settings()->setAttribute(QWebEngineSettings::WebRTCPublicInterfacesOnly, false); #endif profile()->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies); } MarkdownEnginePage::~MarkdownEnginePage() { } bool MarkdownEnginePage::acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) { Q_UNUSED(type); Q_UNUSED(isMainFrame); if (url.scheme() == QLatin1String("data")) { return true; } return false; } diff --git a/kmail/editorconvertertextplugins/markdown/markdownenginepage.h b/kmail/editorconvertertextplugins/markdown/markdownenginepage.h index 96dd1324..1d3269aa 100644 --- a/kmail/editorconvertertextplugins/markdown/markdownenginepage.h +++ b/kmail/editorconvertertextplugins/markdown/markdownenginepage.h @@ -1,36 +1,36 @@ /* - Copyright (C) 2018 Laurent Montel + Copyright (C) 2018-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef MARKDOWNENGINEPAGE_H #define MARKDOWNENGINEPAGE_H #include class MarkdownEnginePage : public QWebEnginePage { Q_OBJECT public: explicit MarkdownEnginePage(QObject *parent = nullptr); ~MarkdownEnginePage() override; protected: bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) override; }; #endif // MARKDOWNENGINEPAGE_H diff --git a/kmail/editorplugins/sharetext/sharetextpurposemenuwidget.cpp b/kmail/editorplugins/sharetext/sharetextpurposemenuwidget.cpp index a9b9852d..ff4f1dbf 100644 --- a/kmail/editorplugins/sharetext/sharetextpurposemenuwidget.cpp +++ b/kmail/editorplugins/sharetext/sharetextpurposemenuwidget.cpp @@ -1,42 +1,42 @@ /* - Copyright (C) 2018 Laurent Montel + Copyright (C) 2018-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "sharetextpurposemenuwidget.h" #include "sharetextplugineditorinterface.h" #include SharetextPurposeMenuWidget::SharetextPurposeMenuWidget(QWidget *parentWidget, QObject *parent) : PimCommon::PurposeMenuWidget(parentWidget, parent) { } SharetextPurposeMenuWidget::~SharetextPurposeMenuWidget() { } QByteArray SharetextPurposeMenuWidget::text() { if (mInterface) { return mInterface->richTextEditor()->toPlainText().toUtf8(); } return {}; } void SharetextPurposeMenuWidget::setEditorWidget(ShareTextPluginEditorInterface *interface) { mInterface = interface; } diff --git a/kmail/editorplugins/sharetext/sharetextpurposemenuwidget.h b/kmail/editorplugins/sharetext/sharetextpurposemenuwidget.h index 49280a95..d413a4de 100644 --- a/kmail/editorplugins/sharetext/sharetextpurposemenuwidget.h +++ b/kmail/editorplugins/sharetext/sharetextpurposemenuwidget.h @@ -1,38 +1,38 @@ /* - Copyright (C) 2018 Laurent Montel + Copyright (C) 2018-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SHARETEXTPURPOSEMENUWIDGET_H #define SHARETEXTPURPOSEMENUWIDGET_H #include class ShareTextPluginEditorInterface; class SharetextPurposeMenuWidget : public PimCommon::PurposeMenuWidget { Q_OBJECT public: explicit SharetextPurposeMenuWidget(QWidget *parentWidget, QObject *parent = nullptr); ~SharetextPurposeMenuWidget() override; QByteArray text() override; void setEditorWidget(ShareTextPluginEditorInterface *interface); private: ShareTextPluginEditorInterface *mInterface = nullptr; }; #endif // SHARETEXTPURPOSEMENUWIDGET_H