Make the pause modes a QFlags.
authorRichard Moore <rich@kde.org>
Sat, 28 Jan 2012 13:41:20 +0000 (13:41 +0000)
committerQt by Nokia <qt-info@nokia.com>
Mon, 30 Jan 2012 15:39:56 +0000 (16:39 +0100)
The intention is to add additional pause modes over time, this will
be easier if we can just test if a particular reason for pausing is
turned on. If we don't do this we'll end up having to check for each
enum value every time we check what is enabled.

Change-Id: I6b08f0e819b5593e3f6463c3dd175eff8625e155
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
Reviewed-by: Shane Kearns <ext-shane.2.kearns@nokia.com>
src/network/socket/qabstractsocket.cpp
src/network/socket/qabstractsocket.h
src/network/socket/qabstractsocket_p.h
src/network/ssl/qsslsocket_openssl.cpp

index 52b4c0d..6264ee4 100644 (file)
@@ -1390,7 +1390,7 @@ void QAbstractSocket::resume()
 
     \sa setPauseMode(), resume()
 */
-QAbstractSocket::PauseMode QAbstractSocket::pauseMode() const
+QAbstractSocket::PauseModes QAbstractSocket::pauseMode() const
 {
     return d_func()->pauseMode;
 }
@@ -1409,7 +1409,7 @@ QAbstractSocket::PauseMode QAbstractSocket::pauseMode() const
 
     \sa pauseMode(), resume()
 */
-void QAbstractSocket::setPauseMode(PauseMode pauseMode)
+void QAbstractSocket::setPauseMode(PauseModes pauseMode)
 {
     d_func()->pauseMode = pauseMode;
 }
index c9270fa..8d6a7a3 100644 (file)
@@ -124,16 +124,17 @@ public:
     };
     Q_DECLARE_FLAGS(BindMode, BindFlag)
     enum PauseMode {
-        PauseNever,
-        PauseOnNotify
+        PauseNever = 0x0,
+        PauseOnNotify = 0x1
     };
+    Q_DECLARE_FLAGS(PauseModes, PauseMode)
 
     QAbstractSocket(SocketType socketType, QObject *parent);
     virtual ~QAbstractSocket();
 
     virtual void resume(); // to continue after proxy authentication required, SSL errors etc.
-    PauseMode pauseMode() const;
-    void setPauseMode(PauseMode pauseMode);
+    PauseModes pauseMode() const;
+    void setPauseMode(PauseModes pauseMode);
 
     bool bind(const QHostAddress &address, quint16 port = 0, BindMode mode = DefaultForPlatform);
     bool bind(quint16 port = 0, BindMode mode = DefaultForPlatform);
@@ -226,6 +227,7 @@ private:
 
 
 Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractSocket::BindMode)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractSocket::PauseModes)
 
 #ifndef QT_NO_DEBUG_STREAM
 Q_NETWORK_EXPORT QDebug operator<<(QDebug, QAbstractSocket::SocketError);
index 703a2a4..578213f 100644 (file)
@@ -106,7 +106,7 @@ public:
     bool closeCalled;
     bool pendingClose;
 
-    QAbstractSocket::PauseMode pauseMode;
+    QAbstractSocket::PauseModes pauseMode;
 
     QString hostName;
     quint16 port;
index 55bf86b..1c5926e 100644 (file)
@@ -1195,7 +1195,7 @@ bool QSslSocketBackendPrivate::startHandshake()
         bool doEmitSslError = !verifyErrorsHaveBeenIgnored();
         // check whether we need to emit an SSL handshake error
         if (doVerifyPeer && doEmitSslError) {
-            if (q->pauseMode() == QAbstractSocket::PauseOnNotify) {
+            if (q->pauseMode() & QAbstractSocket::PauseOnNotify) {
                 pauseSocketNotifiers(q);
                 paused = true;
             } else {