Make the pause modes a QFlags.

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>
This commit is contained in:
Richard Moore 2012-01-28 13:41:20 +00:00 committed by Qt by Nokia
parent e54dc7c2b5
commit b3a978d661
4 changed files with 10 additions and 8 deletions

View 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;
}

View 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);

View File

@ -106,7 +106,7 @@ public:
bool closeCalled;
bool pendingClose;
QAbstractSocket::PauseMode pauseMode;
QAbstractSocket::PauseModes pauseMode;
QString hostName;
quint16 port;

View 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 {