192 |
192 |
193 socketError = error; |
193 socketError = error; |
194 |
194 |
195 switch (errorString) { |
195 switch (errorString) { |
196 case NonBlockingInitFailedErrorString: |
196 case NonBlockingInitFailedErrorString: |
197 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unable to initialize non-blocking socket")); |
197 socketErrorString = QNativeSocketEngine::tr("Unable to initialize non-blocking socket"); |
198 break; |
198 break; |
199 case BroadcastingInitFailedErrorString: |
199 case BroadcastingInitFailedErrorString: |
200 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unable to initialize broadcast socket")); |
200 socketErrorString = QNativeSocketEngine::tr("Unable to initialize broadcast socket"); |
201 break; |
201 break; |
202 case NoIpV6ErrorString: |
202 case NoIpV6ErrorString: |
203 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Attempt to use IPv6 socket on a platform with no IPv6 support")); |
203 socketErrorString = QNativeSocketEngine::tr("Attempt to use IPv6 socket on a platform with no IPv6 support"); |
204 break; |
204 break; |
205 case RemoteHostClosedErrorString: |
205 case RemoteHostClosedErrorString: |
206 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "The remote host closed the connection")); |
206 socketErrorString = QNativeSocketEngine::tr("The remote host closed the connection"); |
207 break; |
207 break; |
208 case TimeOutErrorString: |
208 case TimeOutErrorString: |
209 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Network operation timed out")); |
209 socketErrorString = QNativeSocketEngine::tr("Network operation timed out"); |
210 break; |
210 break; |
211 case ResourceErrorString: |
211 case ResourceErrorString: |
212 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Out of resources")); |
212 socketErrorString = QNativeSocketEngine::tr("Out of resources"); |
213 break; |
213 break; |
214 case OperationUnsupportedErrorString: |
214 case OperationUnsupportedErrorString: |
215 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unsupported socket operation")); |
215 socketErrorString = QNativeSocketEngine::tr("Unsupported socket operation"); |
216 break; |
216 break; |
217 case ProtocolUnsupportedErrorString: |
217 case ProtocolUnsupportedErrorString: |
218 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Protocol type not supported")); |
218 socketErrorString = QNativeSocketEngine::tr("Protocol type not supported"); |
219 break; |
219 break; |
220 case InvalidSocketErrorString: |
220 case InvalidSocketErrorString: |
221 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Invalid socket descriptor")); |
221 socketErrorString = QNativeSocketEngine::tr("Invalid socket descriptor"); |
222 break; |
222 break; |
223 case HostUnreachableErrorString: |
223 case HostUnreachableErrorString: |
224 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Host unreachable")); |
224 socketErrorString = QNativeSocketEngine::tr("Host unreachable"); |
225 break; |
225 break; |
226 case NetworkUnreachableErrorString: |
226 case NetworkUnreachableErrorString: |
227 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Network unreachable")); |
227 socketErrorString = QNativeSocketEngine::tr("Network unreachable"); |
228 break; |
228 break; |
229 case AccessErrorString: |
229 case AccessErrorString: |
230 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Permission denied")); |
230 socketErrorString = QNativeSocketEngine::tr("Permission denied"); |
231 break; |
231 break; |
232 case ConnectionTimeOutErrorString: |
232 case ConnectionTimeOutErrorString: |
233 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Connection timed out")); |
233 socketErrorString = QNativeSocketEngine::tr("Connection timed out"); |
234 break; |
234 break; |
235 case ConnectionRefusedErrorString: |
235 case ConnectionRefusedErrorString: |
236 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Connection refused")); |
236 socketErrorString = QNativeSocketEngine::tr("Connection refused"); |
237 break; |
237 break; |
238 case AddressInuseErrorString: |
238 case AddressInuseErrorString: |
239 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "The bound address is already in use")); |
239 socketErrorString = QNativeSocketEngine::tr("The bound address is already in use"); |
240 break; |
240 break; |
241 case AddressNotAvailableErrorString: |
241 case AddressNotAvailableErrorString: |
242 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "The address is not available")); |
242 socketErrorString = QNativeSocketEngine::tr("The address is not available"); |
243 break; |
243 break; |
244 case AddressProtectedErrorString: |
244 case AddressProtectedErrorString: |
245 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "The address is protected")); |
245 socketErrorString = QNativeSocketEngine::tr("The address is protected"); |
246 break; |
246 break; |
247 case DatagramTooLargeErrorString: |
247 case DatagramTooLargeErrorString: |
248 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Datagram was too large to send")); |
248 socketErrorString = QNativeSocketEngine::tr("Datagram was too large to send"); |
249 break; |
249 break; |
250 case SendDatagramErrorString: |
250 case SendDatagramErrorString: |
251 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unable to send a message")); |
251 socketErrorString = QNativeSocketEngine::tr("Unable to send a message"); |
252 break; |
252 break; |
253 case ReceiveDatagramErrorString: |
253 case ReceiveDatagramErrorString: |
254 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unable to receive a message")); |
254 socketErrorString = QNativeSocketEngine::tr("Unable to receive a message"); |
255 break; |
255 break; |
256 case WriteErrorString: |
256 case WriteErrorString: |
257 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unable to write")); |
257 socketErrorString = QNativeSocketEngine::tr("Unable to write"); |
258 break; |
258 break; |
259 case ReadErrorString: |
259 case ReadErrorString: |
260 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Network error")); |
260 socketErrorString = QNativeSocketEngine::tr("Network error"); |
261 break; |
261 break; |
262 case PortInuseErrorString: |
262 case PortInuseErrorString: |
263 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Another socket is already listening on the same port")); |
263 socketErrorString = QNativeSocketEngine::tr("Another socket is already listening on the same port"); |
264 break; |
264 break; |
265 case NotSocketErrorString: |
265 case NotSocketErrorString: |
266 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Operation on non-socket")); |
266 socketErrorString = QNativeSocketEngine::tr("Operation on non-socket"); |
267 break; |
267 break; |
268 case InvalidProxyTypeString: |
268 case InvalidProxyTypeString: |
269 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "The proxy type is invalid for this operation")); |
269 socketErrorString = QNativeSocketEngine::tr("The proxy type is invalid for this operation"); |
270 break; |
270 break; |
271 case UnknownSocketErrorString: |
271 case UnknownSocketErrorString: |
272 socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unknown error")); |
272 socketErrorString = QNativeSocketEngine::tr("Unknown error"); |
273 break; |
273 break; |
274 } |
274 } |
275 } |
275 } |
276 |
276 |
277 bool QNativeSocketEnginePrivate::checkProxy(const QHostAddress &address) |
277 bool QNativeSocketEnginePrivate::checkProxy(const QHostAddress &address) |
905 |
929 |
906 bool QNativeSocketEngine::waitForReadOrWrite(bool *readyToRead, bool *readyToWrite, |
930 bool QNativeSocketEngine::waitForReadOrWrite(bool *readyToRead, bool *readyToWrite, |
907 bool checkRead, bool checkWrite, |
931 bool checkRead, bool checkWrite, |
908 int msecs, bool *timedOut) |
932 int msecs, bool *timedOut) |
909 { |
933 { |
910 Q_D(const QNativeSocketEngine); |
934 Q_D(QNativeSocketEngine); |
911 Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::waitForWrite(), false); |
935 Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::waitForWrite(), false); |
912 Q_CHECK_NOT_STATE(QNativeSocketEngine::waitForReadOrWrite(), |
936 Q_CHECK_NOT_STATE(QNativeSocketEngine::waitForReadOrWrite(), |
913 QAbstractSocket::UnconnectedState, false); |
937 QAbstractSocket::UnconnectedState, false); |
914 |
938 |
915 int ret = d->nativeSelect(msecs, checkRead, checkWrite, readyToRead, readyToWrite); |
939 int ret = d->nativeSelect(msecs, checkRead, checkWrite, readyToRead, readyToWrite); |