E5Network/E5SslInfoWidget.py

changeset 3190
a9a94491c4fd
parent 3160
209a07d7e401
child 3201
0f115f6db6cb
equal deleted inserted replaced
3189:9a21c547de5f 3190:a9a94491c4fd
51 layout.addWidget(imageLabel, rows, 0, Qt.AlignCenter) 51 layout.addWidget(imageLabel, rows, 0, Qt.AlignCenter)
52 52
53 label = QLabel(self) 53 label = QLabel(self)
54 label.setWordWrap(True) 54 label.setWordWrap(True)
55 label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) 55 label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
56 label.setText(self.trUtf8("Identity")) 56 label.setText(self.tr("Identity"))
57 font = label.font() 57 font = label.font()
58 font.setBold(True) 58 font.setBold(True)
59 label.setFont(font) 59 label.setFont(font)
60 layout.addWidget(label, rows, 1) 60 layout.addWidget(label, rows, 1)
61 rows += 1 61 rows += 1
62 62
63 label = QLabel(self) 63 label = QLabel(self)
64 label.setWordWrap(True) 64 label.setWordWrap(True)
65 if cert.isNull(): 65 if cert.isNull():
66 label.setText(self.trUtf8( 66 label.setText(self.tr(
67 "Warning: this site is NOT carrying a certificate.")) 67 "Warning: this site is NOT carrying a certificate."))
68 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow32.png")) 68 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow32.png"))
69 else: 69 else:
70 if qVersion() >= "5.0.0": 70 if qVersion() >= "5.0.0":
71 valid = not cert.isBlacklisted() 71 valid = not cert.isBlacklisted()
75 if qVersion() >= "5.0.0": 75 if qVersion() >= "5.0.0":
76 txt = ", ".join( 76 txt = ", ".join(
77 cert.issuerInfo(QSslCertificate.CommonName)) 77 cert.issuerInfo(QSslCertificate.CommonName))
78 else: 78 else:
79 txt = cert.issuerInfo(QSslCertificate.CommonName) 79 txt = cert.issuerInfo(QSslCertificate.CommonName)
80 label.setText(self.trUtf8( 80 label.setText(self.tr(
81 "The certificate for this site is valid" 81 "The certificate for this site is valid"
82 " and has been verified by:\n{0}").format( 82 " and has been verified by:\n{0}").format(
83 Utilities.decodeString(txt))) 83 Utilities.decodeString(txt)))
84 imageLabel.setPixmap( 84 imageLabel.setPixmap(
85 UI.PixmapCache.getPixmap("securityHigh32.png")) 85 UI.PixmapCache.getPixmap("securityHigh32.png"))
86 else: 86 else:
87 label.setText(self.trUtf8( 87 label.setText(self.tr(
88 "The certificate for this site is NOT valid.")) 88 "The certificate for this site is NOT valid."))
89 imageLabel.setPixmap( 89 imageLabel.setPixmap(
90 UI.PixmapCache.getPixmap("securityLow32.png")) 90 UI.PixmapCache.getPixmap("securityLow32.png"))
91 layout.addWidget(label, rows, 1) 91 layout.addWidget(label, rows, 1)
92 rows += 1 92 rows += 1
93 93
94 label = QLabel(self) 94 label = QLabel(self)
95 label.setWordWrap(True) 95 label.setWordWrap(True)
96 label.setText( 96 label.setText(
97 '<a href="moresslinfos">' + 97 '<a href="moresslinfos">' +
98 self.trUtf8("Certificate Information") + "</a>") 98 self.tr("Certificate Information") + "</a>")
99 label.linkActivated.connect(self.__showCertificateInfos) 99 label.linkActivated.connect(self.__showCertificateInfos)
100 layout.addWidget(label, rows, 1) 100 layout.addWidget(label, rows, 1)
101 rows += 1 101 rows += 1
102 102
103 ########################################## 103 ##########################################
106 imageLabel = QLabel(self) 106 imageLabel = QLabel(self)
107 layout.addWidget(imageLabel, rows, 0, Qt.AlignCenter) 107 layout.addWidget(imageLabel, rows, 0, Qt.AlignCenter)
108 108
109 label = QLabel(self) 109 label = QLabel(self)
110 label.setWordWrap(True) 110 label.setWordWrap(True)
111 label.setText(self.trUtf8("Encryption")) 111 label.setText(self.tr("Encryption"))
112 font = label.font() 112 font = label.font()
113 font.setBold(True) 113 font.setBold(True)
114 label.setFont(font) 114 label.setFont(font)
115 layout.addWidget(label, rows, 1) 115 layout.addWidget(label, rows, 1)
116 rows += 1 116 rows += 1
117 117
118 cipher = self.__configuration.sessionCipher() 118 cipher = self.__configuration.sessionCipher()
119 if cipher.isNull(): 119 if cipher.isNull():
120 label = QLabel(self) 120 label = QLabel(self)
121 label.setWordWrap(True) 121 label.setWordWrap(True)
122 label.setText(self.trUtf8( 122 label.setText(self.tr(
123 'Your connection to "{0}" is NOT encrypted.\n').format( 123 'Your connection to "{0}" is NOT encrypted.\n').format(
124 self.__url.host())) 124 self.__url.host()))
125 layout.addWidget(label, rows, 1) 125 layout.addWidget(label, rows, 1)
126 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow32.png")) 126 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow32.png"))
127 rows += 1 127 rows += 1
128 else: 128 else:
129 label = QLabel(self) 129 label = QLabel(self)
130 label.setWordWrap(True) 130 label.setWordWrap(True)
131 label.setText(self.trUtf8( 131 label.setText(self.tr(
132 'Your connection to "{0}" is encrypted.').format( 132 'Your connection to "{0}" is encrypted.').format(
133 self.__url.host())) 133 self.__url.host()))
134 layout.addWidget(label, rows, 1) 134 layout.addWidget(label, rows, 1)
135 135
136 proto = cipher.protocol() 136 proto = cipher.protocol()
145 elif proto == QSsl.SslV2: 145 elif proto == QSsl.SslV2:
146 sslVersion = "SSL 2.0" 146 sslVersion = "SSL 2.0"
147 imageLabel.setPixmap( 147 imageLabel.setPixmap(
148 UI.PixmapCache.getPixmap("securityLow32.png")) 148 UI.PixmapCache.getPixmap("securityLow32.png"))
149 else: 149 else:
150 sslVersion = self.trUtf8("unknown") 150 sslVersion = self.tr("unknown")
151 imageLabel.setPixmap( 151 imageLabel.setPixmap(
152 UI.PixmapCache.getPixmap("securityLow32.png")) 152 UI.PixmapCache.getPixmap("securityLow32.png"))
153 rows += 1 153 rows += 1
154 154
155 label = QLabel(self) 155 label = QLabel(self)
156 label.setWordWrap(True) 156 label.setWordWrap(True)
157 label.setText(self.trUtf8( 157 label.setText(self.tr(
158 "It uses protocol: {0}").format(sslVersion)) 158 "It uses protocol: {0}").format(sslVersion))
159 layout.addWidget(label, rows, 1) 159 layout.addWidget(label, rows, 1)
160 rows += 1 160 rows += 1
161 161
162 label = QLabel(self) 162 label = QLabel(self)
163 label.setWordWrap(True) 163 label.setWordWrap(True)
164 label.setText(self.trUtf8( 164 label.setText(self.tr(
165 "It is encrypted using {0} at {1} bits, " 165 "It is encrypted using {0} at {1} bits, "
166 "with {2} for message authentication and " 166 "with {2} for message authentication and "
167 "{3} as key exchange mechanism.\n\n").format( 167 "{3} as key exchange mechanism.\n\n").format(
168 cipher.encryptionMethod(), 168 cipher.encryptionMethod(),
169 cipher.usedBits(), 169 cipher.usedBits(),

eric ide

mercurial