summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-27 11:20:19 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-27 12:09:08 +0000
commit28d3a4eb261318046464ea18d329aeecb9f1d9d0 (patch)
tree7a4a6ce7e7a41d44b00a8ca29f4ffc84ebe67390
parent3839e65f910a7e110404e9d8cb8387366fcf0e1d (diff)
Cleanup QML client certificate selection implementation
Get rid of copy constructors for QObjects by making the elements objects on the heap. Change-Id: Ic9a214f01b39feb824b99d17d17fd342d431cd97 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io> Reviewed-by: Michal Klocek <michal.klocek@qt.io>
-rw-r--r--src/webengine/api/qquickwebengineclientcertificateselection.cpp19
-rw-r--r--src/webengine/api/qquickwebengineclientcertificateselection_p.h6
-rw-r--r--src/webengine/plugin/plugin.cpp4
3 files changed, 6 insertions, 23 deletions
diff --git a/src/webengine/api/qquickwebengineclientcertificateselection.cpp b/src/webengine/api/qquickwebengineclientcertificateselection.cpp
index 56cf1ff6..c48a5988 100644
--- a/src/webengine/api/qquickwebengineclientcertificateselection.cpp
+++ b/src/webengine/api/qquickwebengineclientcertificateselection.cpp
@@ -55,23 +55,10 @@ QT_BEGIN_NAMESPACE
\sa {WebEngineClientCertificateSelection::certificates} {WebEngineClientCertificateSelection.certificates}
*/
-QQuickWebEngineClientCertificateOption::QQuickWebEngineClientCertificateOption() = default;
-
QQuickWebEngineClientCertificateOption::QQuickWebEngineClientCertificateOption(QQuickWebEngineClientCertificateSelection *selection, int index)
- : QObject(), m_selection(selection), m_index(index)
-{}
-
-QQuickWebEngineClientCertificateOption::QQuickWebEngineClientCertificateOption(const QQuickWebEngineClientCertificateOption &other)
- : QObject(), m_selection(other.m_selection), m_index(other.m_index)
+ : QObject(selection), m_selection(selection), m_index(index)
{}
-QQuickWebEngineClientCertificateOption &QQuickWebEngineClientCertificateOption::operator=(const QQuickWebEngineClientCertificateOption &other)
-{
- m_selection = other.m_selection;
- m_index = other.m_index;
- return *this;
-}
-
/*!
\qmlproperty string WebEngineClientCertificateOption::issuer
\brief The issuer of the certificate.
@@ -164,7 +151,7 @@ QQuickWebEngineClientCertificateOption *QQuickWebEngineClientCertificateSelectio
QQuickWebEngineClientCertificateSelection *d = static_cast<QQuickWebEngineClientCertificateSelection *>(p->object);
if (idx < 0 || idx >= d->m_certificates.size())
return nullptr;
- return &d->m_certificates[idx];
+ return d->m_certificates[idx];
}
/*!
@@ -177,7 +164,7 @@ QQmlListProperty<QQuickWebEngineClientCertificateOption> QQuickWebEngineClientCe
if (m_certificates.empty()) {
QVector<QSslCertificate> certificates = d_ptr->certificates();
for (int i = 0; i < certificates.count(); ++i)
- m_certificates.push_back(QQuickWebEngineClientCertificateOption(this, i));
+ m_certificates.push_back(new QQuickWebEngineClientCertificateOption(this, i));
}
return QQmlListProperty<QQuickWebEngineClientCertificateOption>(
diff --git a/src/webengine/api/qquickwebengineclientcertificateselection_p.h b/src/webengine/api/qquickwebengineclientcertificateselection_p.h
index 7f5a2629..adf8b5f7 100644
--- a/src/webengine/api/qquickwebengineclientcertificateselection_p.h
+++ b/src/webengine/api/qquickwebengineclientcertificateselection_p.h
@@ -76,10 +76,6 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineClientCertificateOption : public
Q_PROPERTY(bool isSelfSigned READ isSelfSigned CONSTANT FINAL)
public:
- QQuickWebEngineClientCertificateOption();
- QQuickWebEngineClientCertificateOption(const QQuickWebEngineClientCertificateOption &);
- QQuickWebEngineClientCertificateOption &operator=(const QQuickWebEngineClientCertificateOption &);
-
QString issuer() const;
QString subject() const;
QDateTime effectiveDate() const;
@@ -120,7 +116,7 @@ private:
explicit QQuickWebEngineClientCertificateSelection(QSharedPointer<ClientCertSelectController>);
- mutable QVector<QQuickWebEngineClientCertificateOption> m_certificates;
+ mutable QVector<QQuickWebEngineClientCertificateOption *> m_certificates;
QSharedPointer<ClientCertSelectController> d_ptr;
};
diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp
index 82a76760..381837e0 100644
--- a/src/webengine/plugin/plugin.cpp
+++ b/src/webengine/plugin/plugin.cpp
@@ -159,9 +159,9 @@ public:
msgUncreatableType("RegisterProtocolHandlerRequest"));
qmlRegisterUncreatableType<QQuickWebEngineAction>(uri, 1, 8, "WebEngineAction", msgUncreatableType("WebEngineAction"));
qmlRegisterUncreatableType<QQuickWebEngineClientCertificateSelection>(uri, 1, 9, "WebEngineClientCertificateSelection",
- tr("Cannot create a separate instance of WebEngineClientCertificateSelection"));
+ msgUncreatableType("WebEngineClientCertificateSelection"));
qmlRegisterUncreatableType<QQuickWebEngineClientCertificateOption>(uri, 1, 9, "WebEngineClientCertificateOption",
- tr("Cannot create a separate instance of WebEngineClientCertificateOption"));
+ msgUncreatableType("WebEngineClientCertificateOption"));
qmlRegisterUncreatableType<QWebEngineNotification>(uri, 1, 9, "WebEngineNotification", msgUncreatableType("WebEngineNotification"));
}