523 ircTimestamp(), sender, ircFilter(msg))) |
523 ircTimestamp(), sender, ircFilter(msg))) |
524 if Preferences.getIrc("ShowNotifications"): |
524 if Preferences.getIrc("ShowNotifications"): |
525 if Preferences.getIrc("NotifyMessage"): |
525 if Preferences.getIrc("NotifyMessage"): |
526 self.__ui.showNotification( |
526 self.__ui.showNotification( |
527 UI.PixmapCache.getPixmap("irc48.png"), |
527 UI.PixmapCache.getPixmap("irc48.png"), |
528 self.trUtf8("Channel Message"), msg) |
528 self.tr("Channel Message"), msg) |
529 elif Preferences.getIrc("NotifyNick") and \ |
529 elif Preferences.getIrc("NotifyNick") and \ |
530 self.__userName.lower() in msg.lower(): |
530 self.__userName.lower() in msg.lower(): |
531 self.__ui.showNotification( |
531 self.__ui.showNotification( |
532 UI.PixmapCache.getPixmap("irc48.png"), |
532 UI.PixmapCache.getPixmap("irc48.png"), |
533 self.trUtf8("Nick mentioned"), msg) |
533 self.tr("Nick mentioned"), msg) |
534 |
534 |
535 def addUsers(self, users): |
535 def addUsers(self, users): |
536 """ |
536 """ |
537 Public method to add users to the channel. |
537 Public method to add users to the channel. |
538 |
538 |
551 @return flag indicating whether the message was handled (boolean) |
551 @return flag indicating whether the message was handled (boolean) |
552 """ |
552 """ |
553 if match.group(3).lower() == self.__name.lower(): |
553 if match.group(3).lower() == self.__name.lower(): |
554 if self.__userName != match.group(1): |
554 if self.__userName != match.group(1): |
555 IrcUserItem(match.group(1), self.usersList) |
555 IrcUserItem(match.group(1), self.usersList) |
556 msg = self.trUtf8( |
556 msg = self.tr( |
557 "{0} has joined the channel {1} ({2}).").format( |
557 "{0} has joined the channel {1} ({2}).").format( |
558 match.group(1), self.__name, match.group(2)) |
558 match.group(1), self.__name, match.group(2)) |
559 self.__addManagementMessage( |
559 self.__addManagementMessage( |
560 IrcChannelWidget.JoinIndicator, msg) |
560 IrcChannelWidget.JoinIndicator, msg) |
561 else: |
561 else: |
562 msg = self.trUtf8( |
562 msg = self.tr( |
563 "You have joined the channel {0} ({1}).").format( |
563 "You have joined the channel {0} ({1}).").format( |
564 self.__name, match.group(2)) |
564 self.__name, match.group(2)) |
565 self.__addManagementMessage( |
565 self.__addManagementMessage( |
566 IrcChannelWidget.JoinIndicator, msg) |
566 IrcChannelWidget.JoinIndicator, msg) |
567 if Preferences.getIrc("ShowNotifications") and \ |
567 if Preferences.getIrc("ShowNotifications") and \ |
568 Preferences.getIrc("NotifyJoinPart"): |
568 Preferences.getIrc("NotifyJoinPart"): |
569 self.__ui.showNotification( |
569 self.__ui.showNotification( |
570 UI.PixmapCache.getPixmap("irc48.png"), |
570 UI.PixmapCache.getPixmap("irc48.png"), |
571 self.trUtf8("Join Channel"), msg) |
571 self.tr("Join Channel"), msg) |
572 return True |
572 return True |
573 |
573 |
574 return False |
574 return False |
575 |
575 |
576 def __userPart(self, match): |
576 def __userPart(self, match): |
583 if match.group(2).lower() == self.__name.lower(): |
583 if match.group(2).lower() == self.__name.lower(): |
584 itm = self.__findUser(match.group(1)) |
584 itm = self.__findUser(match.group(1)) |
585 self.usersList.takeItem(self.usersList.row(itm)) |
585 self.usersList.takeItem(self.usersList.row(itm)) |
586 del itm |
586 del itm |
587 if match.lastindex == 2: |
587 if match.lastindex == 2: |
588 msg = self.trUtf8("{0} has left {1}.").format( |
588 msg = self.tr("{0} has left {1}.").format( |
589 match.group(1), self.__name) |
589 match.group(1), self.__name) |
590 nmsg = msg |
590 nmsg = msg |
591 self.__addManagementMessage( |
591 self.__addManagementMessage( |
592 IrcChannelWidget.LeaveIndicator, msg) |
592 IrcChannelWidget.LeaveIndicator, msg) |
593 else: |
593 else: |
594 msg = self.trUtf8("{0} has left {1}: {2}.").format( |
594 msg = self.tr("{0} has left {1}: {2}.").format( |
595 match.group(1), self.__name, ircFilter(match.group(3))) |
595 match.group(1), self.__name, ircFilter(match.group(3))) |
596 nmsg = self.trUtf8("{0} has left {1}: {2}.").format( |
596 nmsg = self.tr("{0} has left {1}: {2}.").format( |
597 match.group(1), self.__name, match.group(3)) |
597 match.group(1), self.__name, match.group(3)) |
598 self.__addManagementMessage( |
598 self.__addManagementMessage( |
599 IrcChannelWidget.LeaveIndicator, msg) |
599 IrcChannelWidget.LeaveIndicator, msg) |
600 if Preferences.getIrc("ShowNotifications") and \ |
600 if Preferences.getIrc("ShowNotifications") and \ |
601 Preferences.getIrc("NotifyJoinPart"): |
601 Preferences.getIrc("NotifyJoinPart"): |
602 self.__ui.showNotification( |
602 self.__ui.showNotification( |
603 UI.PixmapCache.getPixmap("irc48.png"), |
603 UI.PixmapCache.getPixmap("irc48.png"), |
604 self.trUtf8("Leave Channel"), nmsg) |
604 self.tr("Leave Channel"), nmsg) |
605 return True |
605 return True |
606 |
606 |
607 return False |
607 return False |
608 |
608 |
609 def __userQuit(self, match): |
609 def __userQuit(self, match): |
616 itm = self.__findUser(match.group(1)) |
616 itm = self.__findUser(match.group(1)) |
617 if itm: |
617 if itm: |
618 self.usersList.takeItem(self.usersList.row(itm)) |
618 self.usersList.takeItem(self.usersList.row(itm)) |
619 del itm |
619 del itm |
620 if match.lastindex == 1: |
620 if match.lastindex == 1: |
621 msg = self.trUtf8("{0} has quit {1}.").format( |
621 msg = self.tr("{0} has quit {1}.").format( |
622 match.group(1), self.__name) |
622 match.group(1), self.__name) |
623 self.__addManagementMessage( |
623 self.__addManagementMessage( |
624 IrcChannelWidget.MessageIndicator, msg) |
624 IrcChannelWidget.MessageIndicator, msg) |
625 else: |
625 else: |
626 msg = self.trUtf8("{0} has quit {1}: {2}.").format( |
626 msg = self.tr("{0} has quit {1}: {2}.").format( |
627 match.group(1), self.__name, ircFilter(match.group(2))) |
627 match.group(1), self.__name, ircFilter(match.group(2))) |
628 self.__addManagementMessage( |
628 self.__addManagementMessage( |
629 IrcChannelWidget.MessageIndicator, msg) |
629 IrcChannelWidget.MessageIndicator, msg) |
630 if Preferences.getIrc("ShowNotifications") and \ |
630 if Preferences.getIrc("ShowNotifications") and \ |
631 Preferences.getIrc("NotifyJoinPart"): |
631 Preferences.getIrc("NotifyJoinPart"): |
632 self.__ui.showNotification( |
632 self.__ui.showNotification( |
633 UI.PixmapCache.getPixmap("irc48.png"), |
633 UI.PixmapCache.getPixmap("irc48.png"), |
634 self.trUtf8("Quit"), msg) |
634 self.tr("Quit"), msg) |
635 |
635 |
636 # always return False for other channels and server to process |
636 # always return False for other channels and server to process |
637 return False |
637 return False |
638 |
638 |
639 def __userNickChange(self, match): |
639 def __userNickChange(self, match): |
647 if itm: |
647 if itm: |
648 itm.setName(match.group(2)) |
648 itm.setName(match.group(2)) |
649 if match.group(1) == self.__userName: |
649 if match.group(1) == self.__userName: |
650 self.__addManagementMessage( |
650 self.__addManagementMessage( |
651 IrcChannelWidget.MessageIndicator, |
651 IrcChannelWidget.MessageIndicator, |
652 self.trUtf8("You are now known as {0}.").format( |
652 self.tr("You are now known as {0}.").format( |
653 match.group(2))) |
653 match.group(2))) |
654 self.__userName = match.group(2) |
654 self.__userName = match.group(2) |
655 else: |
655 else: |
656 self.__addManagementMessage( |
656 self.__addManagementMessage( |
657 IrcChannelWidget.MessageIndicator, |
657 IrcChannelWidget.MessageIndicator, |
658 self.trUtf8("User {0} is now known as {1}.").format( |
658 self.tr("User {0} is now known as {1}.").format( |
659 match.group(1), match.group(2))) |
659 match.group(1), match.group(2))) |
660 |
660 |
661 # always return False for other channels and server to process |
661 # always return False for other channels and server to process |
662 return False |
662 return False |
663 |
663 |
764 for modeChar in modeString: |
764 for modeChar in modeString: |
765 if modeChar == "+": |
765 if modeChar == "+": |
766 continue |
766 continue |
767 elif modeChar == "k": |
767 elif modeChar == "k": |
768 parameter = modesParameters.pop(0) |
768 parameter = modesParameters.pop(0) |
769 modes.append(self.trUtf8( |
769 modes.append(self.tr( |
770 "password protected ({0})").format(parameter)) |
770 "password protected ({0})").format(parameter)) |
771 elif modeChar == "l": |
771 elif modeChar == "l": |
772 parameter = modesParameters.pop(0) |
772 parameter = modesParameters.pop(0) |
773 modes.append(self.trUtf8( |
773 modes.append(self.tr( |
774 "limited to %n user(s)", "", int(parameter))) |
774 "limited to %n user(s)", "", int(parameter))) |
775 elif modeChar in modesDict: |
775 elif modeChar in modesDict: |
776 modes.append(modesDict[modeChar]) |
776 modes.append(modesDict[modeChar]) |
777 else: |
777 else: |
778 modes.append(modeChar) |
778 modes.append(modeChar) |
779 |
779 |
780 self.__addManagementMessage( |
780 self.__addManagementMessage( |
781 IrcChannelWidget.MessageIndicator, |
781 IrcChannelWidget.MessageIndicator, |
782 self.trUtf8("Channel modes: {0}.").format(", ".join(modes))) |
782 self.tr("Channel modes: {0}.").format(", ".join(modes))) |
783 |
783 |
784 return True |
784 return True |
785 |
785 |
786 return False |
786 return False |
787 |
787 |
825 elif mode == "-": |
825 elif mode == "-": |
826 isPlus = False |
826 isPlus = False |
827 continue |
827 continue |
828 elif mode == "a": |
828 elif mode == "a": |
829 if isPlus: |
829 if isPlus: |
830 message = self.trUtf8( |
830 message = self.tr( |
831 "{0} sets the channel mode to 'anonymous'.")\ |
831 "{0} sets the channel mode to 'anonymous'.")\ |
832 .format(nick) |
832 .format(nick) |
833 else: |
833 else: |
834 message = self.trUtf8( |
834 message = self.tr( |
835 "{0} removes the 'anonymous' mode from the" |
835 "{0} removes the 'anonymous' mode from the" |
836 " channel.").format(nick) |
836 " channel.").format(nick) |
837 elif mode == "b": |
837 elif mode == "b": |
838 if isPlus: |
838 if isPlus: |
839 message = self.trUtf8( |
839 message = self.tr( |
840 "{0} sets a ban on {1}.").format( |
840 "{0} sets a ban on {1}.").format( |
841 nick, modesParameters.pop(0)) |
841 nick, modesParameters.pop(0)) |
842 else: |
842 else: |
843 message = self.trUtf8( |
843 message = self.tr( |
844 "{0} removes the ban on {1}.").format( |
844 "{0} removes the ban on {1}.").format( |
845 nick, modesParameters.pop(0)) |
845 nick, modesParameters.pop(0)) |
846 elif mode == "c": |
846 elif mode == "c": |
847 if isPlus: |
847 if isPlus: |
848 message = self.trUtf8( |
848 message = self.tr( |
849 "{0} sets the channel mode to 'no colors" |
849 "{0} sets the channel mode to 'no colors" |
850 " allowed'.").format(nick) |
850 " allowed'.").format(nick) |
851 else: |
851 else: |
852 message = self.trUtf8( |
852 message = self.tr( |
853 "{0} sets the channel mode to 'allow color" |
853 "{0} sets the channel mode to 'allow color" |
854 " codes'.").format(nick) |
854 " codes'.").format(nick) |
855 elif mode == "e": |
855 elif mode == "e": |
856 if isPlus: |
856 if isPlus: |
857 message = self.trUtf8( |
857 message = self.tr( |
858 "{0} sets a ban exception on {1}.").format( |
858 "{0} sets a ban exception on {1}.").format( |
859 nick, modesParameters.pop(0)) |
859 nick, modesParameters.pop(0)) |
860 else: |
860 else: |
861 message = self.trUtf8( |
861 message = self.tr( |
862 "{0} removes the ban exception on {1}.").format( |
862 "{0} removes the ban exception on {1}.").format( |
863 nick, modesParameters.pop(0)) |
863 nick, modesParameters.pop(0)) |
864 elif mode == "i": |
864 elif mode == "i": |
865 if isPlus: |
865 if isPlus: |
866 message = self.trUtf8( |
866 message = self.tr( |
867 "{0} sets the channel mode to 'invite only'.")\ |
867 "{0} sets the channel mode to 'invite only'.")\ |
868 .format(nick) |
868 .format(nick) |
869 else: |
869 else: |
870 message = self.trUtf8( |
870 message = self.tr( |
871 "{0} removes the 'invite only' mode from the" |
871 "{0} removes the 'invite only' mode from the" |
872 " channel.").format(nick) |
872 " channel.").format(nick) |
873 elif mode == "k": |
873 elif mode == "k": |
874 if isPlus: |
874 if isPlus: |
875 message = self.trUtf8( |
875 message = self.tr( |
876 "{0} sets the channel key to '{1}'.").format( |
876 "{0} sets the channel key to '{1}'.").format( |
877 nick, modesParameters.pop(0)) |
877 nick, modesParameters.pop(0)) |
878 else: |
878 else: |
879 message = self.trUtf8( |
879 message = self.tr( |
880 "{0} removes the channel key.").format(nick) |
880 "{0} removes the channel key.").format(nick) |
881 elif mode == "l": |
881 elif mode == "l": |
882 if isPlus: |
882 if isPlus: |
883 message = self.trUtf8( |
883 message = self.tr( |
884 "{0} sets the channel limit to %n nick(s).", "", |
884 "{0} sets the channel limit to %n nick(s).", "", |
885 int(modesParameters.pop(0))).format(nick) |
885 int(modesParameters.pop(0))).format(nick) |
886 else: |
886 else: |
887 message = self.trUtf8( |
887 message = self.tr( |
888 "{0} removes the channel limit.").format(nick) |
888 "{0} removes the channel limit.").format(nick) |
889 elif mode == "m": |
889 elif mode == "m": |
890 if isPlus: |
890 if isPlus: |
891 message = self.trUtf8( |
891 message = self.tr( |
892 "{0} sets the channel mode to 'moderated'.")\ |
892 "{0} sets the channel mode to 'moderated'.")\ |
893 .format(nick) |
893 .format(nick) |
894 else: |
894 else: |
895 message = self.trUtf8( |
895 message = self.tr( |
896 "{0} sets the channel mode to 'unmoderated'.")\ |
896 "{0} sets the channel mode to 'unmoderated'.")\ |
897 .format(nick) |
897 .format(nick) |
898 elif mode == "n": |
898 elif mode == "n": |
899 if isPlus: |
899 if isPlus: |
900 message = self.trUtf8( |
900 message = self.tr( |
901 "{0} sets the channel mode to 'no messages from" |
901 "{0} sets the channel mode to 'no messages from" |
902 " outside'.").format(nick) |
902 " outside'.").format(nick) |
903 else: |
903 else: |
904 message = self.trUtf8( |
904 message = self.tr( |
905 "{0} sets the channel mode to 'allow messages" |
905 "{0} sets the channel mode to 'allow messages" |
906 " from outside'.").format(nick) |
906 " from outside'.").format(nick) |
907 elif mode == "p": |
907 elif mode == "p": |
908 if isPlus: |
908 if isPlus: |
909 message = self.trUtf8( |
909 message = self.tr( |
910 "{0} sets the channel mode to 'private'.")\ |
910 "{0} sets the channel mode to 'private'.")\ |
911 .format(nick) |
911 .format(nick) |
912 else: |
912 else: |
913 message = self.trUtf8( |
913 message = self.tr( |
914 "{0} sets the channel mode to 'public'.")\ |
914 "{0} sets the channel mode to 'public'.")\ |
915 .format(nick) |
915 .format(nick) |
916 elif mode == "q": |
916 elif mode == "q": |
917 if isPlus: |
917 if isPlus: |
918 message = self.trUtf8( |
918 message = self.tr( |
919 "{0} sets the channel mode to 'quiet'.")\ |
919 "{0} sets the channel mode to 'quiet'.")\ |
920 .format(nick) |
920 .format(nick) |
921 else: |
921 else: |
922 message = self.trUtf8( |
922 message = self.tr( |
923 "{0} removes the 'quiet' mode from the channel.")\ |
923 "{0} removes the 'quiet' mode from the channel.")\ |
924 .format(nick) |
924 .format(nick) |
925 elif mode == "r": |
925 elif mode == "r": |
926 continue |
926 continue |
927 elif mode == "s": |
927 elif mode == "s": |
928 if isPlus: |
928 if isPlus: |
929 message = self.trUtf8( |
929 message = self.tr( |
930 "{0} sets the channel mode to 'secret'.")\ |
930 "{0} sets the channel mode to 'secret'.")\ |
931 .format(nick) |
931 .format(nick) |
932 else: |
932 else: |
933 message = self.trUtf8( |
933 message = self.tr( |
934 "{0} sets the channel mode to 'visible'.")\ |
934 "{0} sets the channel mode to 'visible'.")\ |
935 .format(nick) |
935 .format(nick) |
936 elif mode == "t": |
936 elif mode == "t": |
937 if isPlus: |
937 if isPlus: |
938 message = self.trUtf8( |
938 message = self.tr( |
939 "{0} switches on 'topic protection'.").format(nick) |
939 "{0} switches on 'topic protection'.").format(nick) |
940 else: |
940 else: |
941 message = self.trUtf8( |
941 message = self.tr( |
942 "{0} switches off 'topic protection'.")\ |
942 "{0} switches off 'topic protection'.")\ |
943 .format(nick) |
943 .format(nick) |
944 elif mode == "I": |
944 elif mode == "I": |
945 if isPlus: |
945 if isPlus: |
946 message = self.trUtf8( |
946 message = self.tr( |
947 "{0} sets invitation mask {1}.").format( |
947 "{0} sets invitation mask {1}.").format( |
948 nick, modesParameters.pop(0)) |
948 nick, modesParameters.pop(0)) |
949 else: |
949 else: |
950 message = self.trUtf8( |
950 message = self.tr( |
951 "{0} removes the invitation mask {1}.").format( |
951 "{0} removes the invitation mask {1}.").format( |
952 nick, modesParameters.pop(0)) |
952 nick, modesParameters.pop(0)) |
953 |
953 |
954 self.__addManagementMessage(self.trUtf8("Mode"), message) |
954 self.__addManagementMessage(self.tr("Mode"), message) |
955 |
955 |
956 return True |
956 return True |
957 |
957 |
958 return False |
958 return False |
959 |
959 |
1020 ctcpRequest, ctcpArg = ctcpCommand, "" |
1020 ctcpRequest, ctcpArg = ctcpCommand, "" |
1021 ctcpRequest = ctcpRequest.lower() |
1021 ctcpRequest = ctcpRequest.lower() |
1022 if ctcpRequest == "version": |
1022 if ctcpRequest == "version": |
1023 msg = "Eric IRC client {0}, {1}".format(Version, Copyright) |
1023 msg = "Eric IRC client {0}, {1}".format(Version, Copyright) |
1024 self.__addManagementMessage( |
1024 self.__addManagementMessage( |
1025 self.trUtf8("CTCP"), |
1025 self.tr("CTCP"), |
1026 self.trUtf8("Received Version request from {0}.").format( |
1026 self.tr("Received Version request from {0}.").format( |
1027 match.group(1))) |
1027 match.group(1))) |
1028 self.sendCtcpReply.emit(match.group(1), "VERSION " + msg) |
1028 self.sendCtcpReply.emit(match.group(1), "VERSION " + msg) |
1029 elif ctcpRequest == "ping": |
1029 elif ctcpRequest == "ping": |
1030 self.__addManagementMessage( |
1030 self.__addManagementMessage( |
1031 self.trUtf8("CTCP"), |
1031 self.tr("CTCP"), |
1032 self.trUtf8( |
1032 self.tr( |
1033 "Received CTCP-PING request from {0}," |
1033 "Received CTCP-PING request from {0}," |
1034 " sending answer.").format(match.group(1))) |
1034 " sending answer.").format(match.group(1))) |
1035 self.sendCtcpReply.emit( |
1035 self.sendCtcpReply.emit( |
1036 match.group(1), "PING {0}".format(ctcpArg)) |
1036 match.group(1), "PING {0}".format(ctcpArg)) |
1037 elif ctcpRequest == "clientinfo": |
1037 elif ctcpRequest == "clientinfo": |
1038 self.__addManagementMessage( |
1038 self.__addManagementMessage( |
1039 self.trUtf8("CTCP"), |
1039 self.tr("CTCP"), |
1040 self.trUtf8( |
1040 self.tr( |
1041 "Received CTCP-CLIENTINFO request from {0}," |
1041 "Received CTCP-CLIENTINFO request from {0}," |
1042 " sending answer.").format(match.group(1))) |
1042 " sending answer.").format(match.group(1))) |
1043 self.sendCtcpReply.emit( |
1043 self.sendCtcpReply.emit( |
1044 match.group(1), "CLIENTINFO CLIENTINFO PING VERSION") |
1044 match.group(1), "CLIENTINFO CLIENTINFO PING VERSION") |
1045 else: |
1045 else: |
1046 self.__addManagementMessage( |
1046 self.__addManagementMessage( |
1047 self.trUtf8("CTCP"), |
1047 self.tr("CTCP"), |
1048 self.trUtf8("Received unknown CTCP-{0} request from {1}.") |
1048 self.tr("Received unknown CTCP-{0} request from {1}.") |
1049 .format(ctcpRequest, match.group(1))) |
1049 .format(ctcpRequest, match.group(1))) |
1050 return True |
1050 return True |
1051 |
1051 |
1052 return False |
1052 return False |
1053 |
1053 |
1244 """ |
1244 """ |
1245 self.__messagesMenu = QMenu(self) |
1245 self.__messagesMenu = QMenu(self) |
1246 self.__copyMessagesAct = \ |
1246 self.__copyMessagesAct = \ |
1247 self.__messagesMenu.addAction( |
1247 self.__messagesMenu.addAction( |
1248 UI.PixmapCache.getIcon("editCopy.png"), |
1248 UI.PixmapCache.getIcon("editCopy.png"), |
1249 self.trUtf8("Copy"), self.__copyMessages) |
1249 self.tr("Copy"), self.__copyMessages) |
1250 self.__messagesMenu.addSeparator() |
1250 self.__messagesMenu.addSeparator() |
1251 self.__cutAllMessagesAct = \ |
1251 self.__cutAllMessagesAct = \ |
1252 self.__messagesMenu.addAction( |
1252 self.__messagesMenu.addAction( |
1253 UI.PixmapCache.getIcon("editCut.png"), |
1253 UI.PixmapCache.getIcon("editCut.png"), |
1254 self.trUtf8("Cut all"), self.__cutAllMessages) |
1254 self.tr("Cut all"), self.__cutAllMessages) |
1255 self.__copyAllMessagesAct = \ |
1255 self.__copyAllMessagesAct = \ |
1256 self.__messagesMenu.addAction( |
1256 self.__messagesMenu.addAction( |
1257 UI.PixmapCache.getIcon("editCopy.png"), |
1257 UI.PixmapCache.getIcon("editCopy.png"), |
1258 self.trUtf8("Copy all"), self.__copyAllMessages) |
1258 self.tr("Copy all"), self.__copyAllMessages) |
1259 self.__messagesMenu.addSeparator() |
1259 self.__messagesMenu.addSeparator() |
1260 self.__clearMessagesAct = \ |
1260 self.__clearMessagesAct = \ |
1261 self.__messagesMenu.addAction( |
1261 self.__messagesMenu.addAction( |
1262 UI.PixmapCache.getIcon("editDelete.png"), |
1262 UI.PixmapCache.getIcon("editDelete.png"), |
1263 self.trUtf8("Clear"), self.__clearMessages) |
1263 self.tr("Clear"), self.__clearMessages) |
1264 self.__messagesMenu.addSeparator() |
1264 self.__messagesMenu.addSeparator() |
1265 self.__saveMessagesAct = \ |
1265 self.__saveMessagesAct = \ |
1266 self.__messagesMenu.addAction( |
1266 self.__messagesMenu.addAction( |
1267 UI.PixmapCache.getIcon("fileSave.png"), |
1267 UI.PixmapCache.getIcon("fileSave.png"), |
1268 self.trUtf8("Save"), self.__saveMessages) |
1268 self.tr("Save"), self.__saveMessages) |
1269 self.__messagesMenu.addSeparator() |
1269 self.__messagesMenu.addSeparator() |
1270 self.__setMarkerMessagesAct = self.__messagesMenu.addAction( |
1270 self.__setMarkerMessagesAct = self.__messagesMenu.addAction( |
1271 self.trUtf8("Mark Current Position"), self.setMarkerLine) |
1271 self.tr("Mark Current Position"), self.setMarkerLine) |
1272 self.__unsetMarkerMessagesAct = self.__messagesMenu.addAction( |
1272 self.__unsetMarkerMessagesAct = self.__messagesMenu.addAction( |
1273 self.trUtf8("Remove Position Marker"), |
1273 self.tr("Remove Position Marker"), |
1274 self.unsetMarkerLine) |
1274 self.unsetMarkerLine) |
1275 |
1275 |
1276 self.on_messages_copyAvailable(False) |
1276 self.on_messages_copyAvailable(False) |
1277 |
1277 |
1278 @pyqtSlot(bool) |
1278 @pyqtSlot(bool) |
1318 """ |
1318 """ |
1319 Private slot to initialize the users list context menu. |
1319 Private slot to initialize the users list context menu. |
1320 """ |
1320 """ |
1321 self.__usersMenu = QMenu(self) |
1321 self.__usersMenu = QMenu(self) |
1322 self.__whoIsAct = self.__usersMenu.addAction( |
1322 self.__whoIsAct = self.__usersMenu.addAction( |
1323 self.trUtf8("Who Is"), self.__whoIs) |
1323 self.tr("Who Is"), self.__whoIs) |
1324 self.__usersMenu.addSeparator() |
1324 self.__usersMenu.addSeparator() |
1325 self.__privateChatAct = self.__usersMenu.addAction( |
1325 self.__privateChatAct = self.__usersMenu.addAction( |
1326 self.trUtf8("Private Chat"), self.__openPrivateChat) |
1326 self.tr("Private Chat"), self.__openPrivateChat) |
1327 self.__usersMenu.addSeparator() |
1327 self.__usersMenu.addSeparator() |
1328 self.__usersListRefreshAct = self.__usersMenu.addAction( |
1328 self.__usersListRefreshAct = self.__usersMenu.addAction( |
1329 self.trUtf8("Refresh"), self.__sendAutoWhoCommand) |
1329 self.tr("Refresh"), self.__sendAutoWhoCommand) |
1330 |
1330 |
1331 @pyqtSlot(QPoint) |
1331 @pyqtSlot(QPoint) |
1332 def on_usersList_customContextMenuRequested(self, pos): |
1332 def on_usersList_customContextMenuRequested(self, pos): |
1333 """ |
1333 """ |
1334 Private slot to show the context menu of the users list. |
1334 Private slot to show the context menu of the users list. |
1503 userChannels.append(channel) |
1503 userChannels.append(channel) |
1504 |
1504 |
1505 # show messages |
1505 # show messages |
1506 if userChannels: |
1506 if userChannels: |
1507 self.__addManagementMessage( |
1507 self.__addManagementMessage( |
1508 self.trUtf8("Whois"), |
1508 self.tr("Whois"), |
1509 self.trUtf8("{0} is a user on channels: {1}").format( |
1509 self.tr("{0} is a user on channels: {1}").format( |
1510 match.group(1), " ".join(userChannels))) |
1510 match.group(1), " ".join(userChannels))) |
1511 if voiceChannels: |
1511 if voiceChannels: |
1512 self.__addManagementMessage( |
1512 self.__addManagementMessage( |
1513 self.trUtf8("Whois"), |
1513 self.tr("Whois"), |
1514 self.trUtf8("{0} has voice on channels: {1}").format( |
1514 self.tr("{0} has voice on channels: {1}").format( |
1515 match.group(1), " ".join(voiceChannels))) |
1515 match.group(1), " ".join(voiceChannels))) |
1516 if halfopChannels: |
1516 if halfopChannels: |
1517 self.__addManagementMessage( |
1517 self.__addManagementMessage( |
1518 self.trUtf8("Whois"), |
1518 self.tr("Whois"), |
1519 self.trUtf8("{0} is a halfop on channels: {1}").format( |
1519 self.tr("{0} is a halfop on channels: {1}").format( |
1520 match.group(1), " ".join(halfopChannels))) |
1520 match.group(1), " ".join(halfopChannels))) |
1521 if opChannels: |
1521 if opChannels: |
1522 self.__addManagementMessage( |
1522 self.__addManagementMessage( |
1523 self.trUtf8("Whois"), |
1523 self.tr("Whois"), |
1524 self.trUtf8("{0} is an operator on channels: {1}").format( |
1524 self.tr("{0} is an operator on channels: {1}").format( |
1525 match.group(1), " ".join(opChannels))) |
1525 match.group(1), " ".join(opChannels))) |
1526 if ownerChannels: |
1526 if ownerChannels: |
1527 self.__addManagementMessage( |
1527 self.__addManagementMessage( |
1528 self.trUtf8("Whois"), |
1528 self.tr("Whois"), |
1529 self.trUtf8("{0} is owner of channels: {1}").format( |
1529 self.tr("{0} is owner of channels: {1}").format( |
1530 match.group(1), " ".join(ownerChannels))) |
1530 match.group(1), " ".join(ownerChannels))) |
1531 if adminChannels: |
1531 if adminChannels: |
1532 self.__addManagementMessage( |
1532 self.__addManagementMessage( |
1533 self.trUtf8("Whois"), |
1533 self.tr("Whois"), |
1534 self.trUtf8("{0} is admin on channels: {1}").format( |
1534 self.tr("{0} is admin on channels: {1}").format( |
1535 match.group(1), " ".join(adminChannels))) |
1535 match.group(1), " ".join(adminChannels))) |
1536 return True |
1536 return True |
1537 |
1537 |
1538 return False |
1538 return False |
1539 |
1539 |
1598 signonTimestamp = int(match.group(3)) |
1598 signonTimestamp = int(match.group(3)) |
1599 signonTime = QDateTime() |
1599 signonTime = QDateTime() |
1600 signonTime.setTime_t(signonTimestamp) |
1600 signonTime.setTime_t(signonTimestamp) |
1601 |
1601 |
1602 if days: |
1602 if days: |
1603 daysString = self.trUtf8("%n day(s)", "", days) |
1603 daysString = self.tr("%n day(s)", "", days) |
1604 hoursString = self.trUtf8("%n hour(s)", "", hours) |
1604 hoursString = self.tr("%n hour(s)", "", hours) |
1605 minutesString = self.trUtf8("%n minute(s)", "", minutes) |
1605 minutesString = self.tr("%n minute(s)", "", minutes) |
1606 secondsString = self.trUtf8("%n second(s)", "", seconds) |
1606 secondsString = self.tr("%n second(s)", "", seconds) |
1607 self.__addManagementMessage( |
1607 self.__addManagementMessage( |
1608 self.trUtf8("Whois"), |
1608 self.tr("Whois"), |
1609 self.trUtf8( |
1609 self.tr( |
1610 "{0} has been idle for {1}, {2}, {3}, and {4}.", |
1610 "{0} has been idle for {1}, {2}, {3}, and {4}.", |
1611 "{0} = name of person, {1} = (x days)," |
1611 "{0} = name of person, {1} = (x days)," |
1612 " {2} = (x hours), {3} = (x minutes)," |
1612 " {2} = (x hours), {3} = (x minutes)," |
1613 " {4} = (x seconds)").format( |
1613 " {4} = (x seconds)").format( |
1614 match.group(1), daysString, hoursString, minutesString, |
1614 match.group(1), daysString, hoursString, minutesString, |
1615 secondsString)) |
1615 secondsString)) |
1616 elif hours: |
1616 elif hours: |
1617 hoursString = self.trUtf8("%n hour(s)", "", hours) |
1617 hoursString = self.tr("%n hour(s)", "", hours) |
1618 minutesString = self.trUtf8("%n minute(s)", "", minutes) |
1618 minutesString = self.tr("%n minute(s)", "", minutes) |
1619 secondsString = self.trUtf8("%n second(s)", "", seconds) |
1619 secondsString = self.tr("%n second(s)", "", seconds) |
1620 self.__addManagementMessage( |
1620 self.__addManagementMessage( |
1621 self.trUtf8("Whois"), |
1621 self.tr("Whois"), |
1622 self.trUtf8( |
1622 self.tr( |
1623 "{0} has been idle for {1}, {2}, and {3}.", |
1623 "{0} has been idle for {1}, {2}, and {3}.", |
1624 "{0} = name of person, {1} = (x hours), " |
1624 "{0} = name of person, {1} = (x hours), " |
1625 "{2} = (x minutes), {3} = (x seconds)") |
1625 "{2} = (x minutes), {3} = (x seconds)") |
1626 .format(match.group(1), hoursString, minutesString, |
1626 .format(match.group(1), hoursString, minutesString, |
1627 secondsString)) |
1627 secondsString)) |
1628 elif minutes: |
1628 elif minutes: |
1629 minutesString = self.trUtf8("%n minute(s)", "", minutes) |
1629 minutesString = self.tr("%n minute(s)", "", minutes) |
1630 secondsString = self.trUtf8("%n second(s)", "", seconds) |
1630 secondsString = self.tr("%n second(s)", "", seconds) |
1631 self.__addManagementMessage( |
1631 self.__addManagementMessage( |
1632 self.trUtf8("Whois"), |
1632 self.tr("Whois"), |
1633 self.trUtf8( |
1633 self.tr( |
1634 "{0} has been idle for {1} and {2}.", |
1634 "{0} has been idle for {1} and {2}.", |
1635 "{0} = name of person, {1} = (x minutes), " |
1635 "{0} = name of person, {1} = (x minutes), " |
1636 "{3} = (x seconds)") |
1636 "{3} = (x seconds)") |
1637 .format(match.group(1), minutesString, secondsString)) |
1637 .format(match.group(1), minutesString, secondsString)) |
1638 else: |
1638 else: |
1639 self.__addManagementMessage( |
1639 self.__addManagementMessage( |
1640 self.trUtf8("Whois"), |
1640 self.tr("Whois"), |
1641 self.trUtf8( |
1641 self.tr( |
1642 "{0} has been idle for %n second(s).", "", |
1642 "{0} has been idle for %n second(s).", "", |
1643 seconds).format(match.group(1))) |
1643 seconds).format(match.group(1))) |
1644 |
1644 |
1645 if not signonTime.isNull(): |
1645 if not signonTime.isNull(): |
1646 self.__addManagementMessage( |
1646 self.__addManagementMessage( |
1647 self.trUtf8("Whois"), |
1647 self.tr("Whois"), |
1648 self.trUtf8("{0} has been online since {1}.").format( |
1648 self.tr("{0} has been online since {1}.").format( |
1649 match.group(1), |
1649 match.group(1), |
1650 signonTime.toString("yyyy-MM-dd, hh:mm:ss"))) |
1650 signonTime.toString("yyyy-MM-dd, hh:mm:ss"))) |
1651 return True |
1651 return True |
1652 |
1652 |
1653 return False |
1653 return False |