diff options
Diffstat (limited to 'sources/pyside6/PySide6')
3 files changed, 63 insertions, 1 deletions
diff --git a/sources/pyside6/PySide6/QtWebEngineCore/CMakeLists.txt b/sources/pyside6/PySide6/QtWebEngineCore/CMakeLists.txt index f6a3fb35c..0da2c6c7b 100644 --- a/sources/pyside6/PySide6/QtWebEngineCore/CMakeLists.txt +++ b/sources/pyside6/PySide6/QtWebEngineCore/CMakeLists.txt @@ -4,6 +4,7 @@ set(QtWebEngineCore_SRC ${QtWebEngineCore_GEN_DIR}/qwebenginecertificateerror_wrapper.cpp ${QtWebEngineCore_GEN_DIR}/qwebenginecontextmenurequest_wrapper.cpp ${QtWebEngineCore_GEN_DIR}/qwebenginecookiestore_wrapper.cpp +${QtWebEngineCore_GEN_DIR}/qwebenginecookiestore_filterrequest_wrapper.cpp ${QtWebEngineCore_GEN_DIR}/qwebenginedownloadrequest_wrapper.cpp ${QtWebEngineCore_GEN_DIR}/qwebenginefullscreenrequest_wrapper.cpp ${QtWebEngineCore_GEN_DIR}/qwebenginehistory_wrapper.cpp diff --git a/sources/pyside6/PySide6/QtWebEngineCore/typesystem_webenginecore.xml b/sources/pyside6/PySide6/QtWebEngineCore/typesystem_webenginecore.xml index 22ff8b777..478621736 100644 --- a/sources/pyside6/PySide6/QtWebEngineCore/typesystem_webenginecore.xml +++ b/sources/pyside6/PySide6/QtWebEngineCore/typesystem_webenginecore.xml @@ -46,7 +46,13 @@ <load-typesystem name="QtPrintSupport/typesystem_printsupport.xml" generate="no"/> <load-typesystem name="QtWebChannel/typesystem_webchannel.xml" generate="no"/> - <object-type name="QWebEngineCookieStore"/> + <object-type name="QWebEngineCookieStore"> + <value-type name="FilterRequest" /> + <add-function signature="setCookieFilter(PyCallable* @filterCallback@)"> + <inject-code class="target" position="beginning" file="../glue/qtwebenginecore.cpp" + snippet="qwebenginecookiestore-setcookiefilter"/> + </add-function> + </object-type> <value-type name="QWebEngineCertificateError"> <enum-type name="Type"/> diff --git a/sources/pyside6/PySide6/glue/qtwebenginecore.cpp b/sources/pyside6/PySide6/glue/qtwebenginecore.cpp new file mode 100644 index 000000000..41fe99440 --- /dev/null +++ b/sources/pyside6/PySide6/glue/qtwebenginecore.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt for Python. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// @snippet qwebenginecookiestore-setcookiefilter +auto callable = %PYARG_1; +auto callback = [callable](const QWebEngineCookieStore::FilterRequest& filterRequest) -> bool +{ + Shiboken::GilState state; + Shiboken::AutoDecRef arglist(PyTuple_New(1)); + PyTuple_SET_ITEM(arglist, 0, + %CONVERTTOPYTHON[QWebEngineCookieStore::FilterRequest](filterRequest)); + Py_INCREF(callable); + PyObject* ret = PyObject_CallObject(callable, arglist); + Py_DECREF(callable); + return ret; + +}; +%CPPSELF.%FUNCTION_NAME(callback); +// @snippet qwebenginecookiestore-setcookiefilter |