186 if not self.isVisible(): |
186 if not self.isVisible(): |
187 self.__ui.showNotification( |
187 self.__ui.showNotification( |
188 UI.PixmapCache.getPixmap("cooperation48.png"), |
188 UI.PixmapCache.getPixmap("cooperation48.png"), |
189 self.trUtf8("New User"), self.trUtf8("{0} has joined.") |
189 self.trUtf8("New User"), self.trUtf8("{0} has joined.") |
190 .format(nick)) |
190 .format(nick)) |
|
191 |
191 def __participantLeft(self, nick): |
192 def __participantLeft(self, nick): |
192 """ |
193 """ |
193 Private slot handling a participant leaving the session. |
194 Private slot handling a participant leaving the session. |
194 |
195 |
195 @param nick nick name of the participant (string) |
196 @param nick nick name of the participant (string) |
228 """ |
229 """ |
229 if from_ == "" or message == "": |
230 if from_ == "" or message == "": |
230 return |
231 return |
231 |
232 |
232 self.chatEdit.append( |
233 self.chatEdit.append( |
233 QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + \ |
234 QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + |
234 " <" + from_ + ">:") |
235 " <" + from_ + ">:") |
235 self.chatEdit.append(message + "\n") |
236 self.chatEdit.append(message + "\n") |
236 bar = self.chatEdit.verticalScrollBar() |
237 bar = self.chatEdit.verticalScrollBar() |
237 bar.setValue(bar.maximum()) |
238 bar.setValue(bar.maximum()) |
238 |
239 |
302 """ |
303 """ |
303 if self.__client.isListening(): |
304 if self.__client.isListening(): |
304 self.__client.close() |
305 self.__client.close() |
305 self.serverButton.setText(self.trUtf8("Start Server")) |
306 self.serverButton.setText(self.trUtf8("Start Server")) |
306 self.serverPortSpin.setEnabled(True) |
307 self.serverPortSpin.setEnabled(True) |
307 if (self.serverPortSpin.value() != |
308 if (self.serverPortSpin.value() != |
308 Preferences.getCooperation("ServerPort")): |
309 Preferences.getCooperation("ServerPort")): |
309 self.serverPortSpin.setValue( |
310 self.serverPortSpin.setValue( |
310 Preferences.getCooperation("ServerPort")) |
311 Preferences.getCooperation("ServerPort")) |
311 self.serverLed.setColor(QColor(Qt.red)) |
312 self.serverLed.setColor(QColor(Qt.red)) |
312 else: |
313 else: |
318 self.serverPortSpin.setEnabled(False) |
319 self.serverPortSpin.setEnabled(False) |
319 self.serverLed.setColor(QColor(Qt.green)) |
320 self.serverLed.setColor(QColor(Qt.green)) |
320 else: |
321 else: |
321 self.__showErrorMessage( |
322 self.__showErrorMessage( |
322 self.trUtf8("! Server Error: {0}\n").format( |
323 self.trUtf8("! Server Error: {0}\n").format( |
323 self.__client.errorString()) |
324 self.__client.errorString()) |
324 ) |
325 ) |
325 |
326 |
326 def __setConnected(self, connected): |
327 def __setConnected(self, connected): |
327 """ |
328 """ |
328 Private slot to set the connected state. |
329 Private slot to set the connected state. |
565 if not ext: |
566 if not ext: |
566 ex = selectedFilter.split("(*")[1].split(")")[0] |
567 ex = selectedFilter.split("(*")[1].split(")")[0] |
567 if ex: |
568 if ex: |
568 fname += ex |
569 fname += ex |
569 if QFileInfo(fname).exists(): |
570 if QFileInfo(fname).exists(): |
570 res = E5MessageBox.yesNo(self, |
571 res = E5MessageBox.yesNo( |
|
572 self, |
571 self.trUtf8("Save Chat"), |
573 self.trUtf8("Save Chat"), |
572 self.trUtf8("<p>The file <b>{0}</b> already exists." |
574 self.trUtf8("<p>The file <b>{0}</b> already exists." |
573 " Overwrite it?</p>").format(fname), |
575 " Overwrite it?</p>").format(fname), |
574 icon=E5MessageBox.Warning) |
576 icon=E5MessageBox.Warning) |
575 if not res: |
577 if not res: |
579 try: |
581 try: |
580 f = open(fname, "w", encoding="utf-8") |
582 f = open(fname, "w", encoding="utf-8") |
581 f.write(txt) |
583 f.write(txt) |
582 f.close() |
584 f.close() |
583 except IOError as err: |
585 except IOError as err: |
584 E5MessageBox.critical(self, |
586 E5MessageBox.critical( |
|
587 self, |
585 self.trUtf8("Error saving Chat"), |
588 self.trUtf8("Error saving Chat"), |
586 self.trUtf8("""<p>The chat contents could not be""" |
589 self.trUtf8("""<p>The chat contents could not be""" |
587 """ written to <b>{0}</b></p>""" |
590 """ written to <b>{0}</b></p>""" |
588 """<p>Reason: {1}</p>""") .format( |
591 """<p>Reason: {1}</p>""") .format( |
589 fname, str(err))) |
592 fname, str(err))) |
590 |
593 |
591 def __copyChat(self): |
594 def __copyChat(self): |
592 """ |
595 """ |
593 Private slot to copy the contents of the chat display to the clipboard. |
596 Private slot to copy the contents of the chat display to the clipboard. |
594 """ |
597 """ |
688 self.chatEdit.append( |
691 self.chatEdit.append( |
689 QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + |
692 QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + |
690 ":") |
693 ":") |
691 self.chatEdit.append( |
694 self.chatEdit.append( |
692 self.trUtf8("* {0} has been banned and kicked.\n") |
695 self.trUtf8("* {0} has been banned and kicked.\n") |
693 .format( itm.text().split("@")[0])) |
696 .format(itm.text().split("@")[0])) |
694 self.chatEdit.setTextColor(color) |
697 self.chatEdit.setTextColor(color) |
695 |
698 |
696 def shutdown(self): |
699 def shutdown(self): |
697 """ |
700 """ |
698 Public method to shut down the cooperation system. |
701 Public method to shut down the cooperation system. |