summaryrefslogtreecommitdiff
blob: f97e0041698a27f07b2ae7eddab4f799f4c1265a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
From a0b372dfb6d37d0a81a545239128fec5ee94283c Mon Sep 17 00:00:00 2001
From: Nicolas Fella <nicolas.fella@gmx.de>
Date: Sun, 15 Oct 2023 18:51:29 +0200
Subject: [PATCH 02/10] Port to new connection syntax

---
 example/oauthclient.cpp    |  8 ++++----
 src/base-plugin.cpp        | 12 ++++++------
 src/plugin.cpp             | 18 ++++++------------
 tests/oauth2plugintest.cpp |  4 ++--
 4 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/example/oauthclient.cpp b/example/oauthclient.cpp
index adfcabf..328e8b7 100644
--- a/example/oauthclient.cpp
+++ b/example/oauthclient.cpp
@@ -47,10 +47,10 @@ OAuthClient::~OAuthClient()
 void OAuthClient::authenticate()
 {
     SignOn::AuthSession *m_session = m_identity->createSession("oauth2");
-    QObject::connect(m_session, SIGNAL(response(const SignOn::SessionData &)),
-                     this, SLOT(onResponse(const SignOn::SessionData &)));
-    QObject::connect(m_session, SIGNAL(error(const SignOn::Error &)),
-                     this, SLOT(onError(const SignOn::Error &)));
+    QObject::connect(m_session, &SignOn::AuthSession::response,
+                     this, &OAuthClient::onResponse);
+    QObject::connect(m_session, &SignOn::AuthSession::error,
+                     this, &OAuthClient::onError);
 
     OAuth2PluginData data;
     data.setHost("www.facebook.com");
diff --git a/src/base-plugin.cpp b/src/base-plugin.cpp
index aa2d639..d5ce81c 100644
--- a/src/base-plugin.cpp
+++ b/src/base-plugin.cpp
@@ -124,12 +124,12 @@ void BasePlugin::postRequest(const QNetworkRequest &request,
     Q_D(BasePlugin);
 
     d->m_reply = d->m_networkAccessManager->post(request, data);
-    connect(d->m_reply, SIGNAL(finished()),
-            this, SLOT(onPostFinished()));
-    connect(d->m_reply, SIGNAL(error(QNetworkReply::NetworkError)),
-            this, SLOT(onNetworkError(QNetworkReply::NetworkError)));
-    connect(d->m_reply, SIGNAL(sslErrors(QList<QSslError>)),
-            this, SLOT(handleSslErrors(QList<QSslError>)));
+    connect(d->m_reply, &QNetworkReply::finished,
+            this, &BasePlugin::onPostFinished);
+    connect(d->m_reply, &QNetworkReply::error,
+            this, &BasePlugin::onNetworkError);
+    connect(d->m_reply, &QNetworkReply::sslErrors,
+            this, &BasePlugin::handleSslErrors);
 }
 
 void BasePlugin::serverReply(QNetworkReply *reply)
diff --git a/src/plugin.cpp b/src/plugin.cpp
index e6af807..c764609 100644
--- a/src/plugin.cpp
+++ b/src/plugin.cpp
@@ -107,18 +107,12 @@ void Plugin::process(const SignOn::SessionData &inData,
     impl->setNetworkAccessManager(m_networkAccessManager);
 
     // Forward the signals from the implementation
-    connect(impl, SIGNAL(result(const SignOn::SessionData &)),
-            SIGNAL(result(const SignOn::SessionData &)));
-    connect(impl, SIGNAL(store(const SignOn::SessionData &)),
-            SIGNAL(store(const SignOn::SessionData &)));
-    connect(impl, SIGNAL(error(const SignOn::Error &)),
-            SIGNAL(error(const SignOn::Error &)));
-    connect(impl, SIGNAL(userActionRequired(const SignOn::UiSessionData &)),
-            SIGNAL(userActionRequired(const SignOn::UiSessionData &)));
-    connect(impl, SIGNAL(refreshed(const SignOn::UiSessionData &)),
-            SIGNAL(refreshed(const SignOn::UiSessionData &)));
-    connect(impl, SIGNAL(statusChanged(const AuthPluginState, const QString&)),
-            SIGNAL(statusChanged(const AuthPluginState, const QString&)));
+    connect(impl, &BasePlugin::result, this, &Plugin::result);
+    connect(impl, &BasePlugin::store, this, &Plugin::store);
+    connect(impl, &BasePlugin::error, this, &Plugin::error);
+    connect(impl, &BasePlugin::userActionRequired, this, &Plugin::userActionRequired);
+    connect(impl, &BasePlugin::refreshed, this, &Plugin::refreshed);
+    connect(impl, &BasePlugin::statusChanged, this, &Plugin::statusChanged);
 
     impl->process(inData, mechanism);
 }
diff --git a/tests/oauth2plugintest.cpp b/tests/oauth2plugintest.cpp
index b257dc7..9e16950 100644
--- a/tests/oauth2plugintest.cpp
+++ b/tests/oauth2plugintest.cpp
@@ -142,8 +142,8 @@ public:
         open(ReadOnly | Unbuffered);
         setHeader(QNetworkRequest::ContentLengthHeader, QVariant(content.size()));
 
-        QTimer::singleShot(0, this, SIGNAL(readyRead()));
-        QTimer::singleShot(10, this, SLOT(finish()));
+        QTimer::singleShot(0, this, &TestNetworkReply::readyRead);
+        QTimer::singleShot(10, this, &TestNetworkReply::finish);
     }
 
 public Q_SLOTS:
-- 
2.43.0