6 """ |
6 """ |
7 Module implementing a class representing a peer connection. |
7 Module implementing a class representing a peer connection. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt4.QtCore import pyqtSignal, QTimer, QTime, QByteArray |
10 from PyQt4.QtCore import pyqtSignal, QTimer, QTime, QByteArray |
11 from PyQt4.QtGui import QMessageBox |
|
12 from PyQt4.QtNetwork import QTcpSocket |
11 from PyQt4.QtNetwork import QTcpSocket |
13 |
12 |
14 from E5Gui import E5MessageBox |
13 from E5Gui import E5MessageBox |
15 |
14 |
16 import Preferences |
15 import Preferences |
191 |
190 |
192 if self.__serverPort != self.peerPort() and \ |
191 if self.__serverPort != self.peerPort() and \ |
193 not Preferences.getCooperation("AutoAcceptConnections"): |
192 not Preferences.getCooperation("AutoAcceptConnections"): |
194 # don't ask for reverse connections or |
193 # don't ask for reverse connections or |
195 # if we shall accept automatically |
194 # if we shall accept automatically |
196 res = E5MessageBox.question(None, |
195 res = E5MessageBox.yesNo(None, |
197 self.trUtf8("New Connection"), |
196 self.trUtf8("New Connection"), |
198 self.trUtf8("""<p>Accept connection from """ |
197 self.trUtf8("""<p>Accept connection from """ |
199 """<strong>{0}@{1}</strong>?</p>""").format( |
198 """<strong>{0}@{1}</strong>?</p>""").format( |
200 user, self.peerAddress().toString()), |
199 user, self.peerAddress().toString()), |
201 QMessageBox.StandardButtons(\ |
200 yesDefault = True) |
202 QMessageBox.No | \ |
201 if not res: |
203 QMessageBox.Yes), |
|
204 QMessageBox.Yes) |
|
205 if res == QMessageBox.No: |
|
206 self.abort() |
202 self.abort() |
207 return |
203 return |
208 |
204 |
209 if not self.__isGreetingMessageSent: |
205 if not self.__isGreetingMessageSent: |
210 self.__sendGreetingMessage() |
206 self.__sendGreetingMessage() |