115 Private slot to handle changes of the fingerprint edit. |
115 Private slot to handle changes of the fingerprint edit. |
116 |
116 |
117 @param txt current text |
117 @param txt current text |
118 @type str |
118 @type str |
119 """ |
119 """ |
|
120 if txt != txt.strip(): |
|
121 # get rid of whitespace |
|
122 txt = txt.strip() |
|
123 self.fingerprintEdit.setText(txt) |
|
124 |
120 if txt.startswith(tuple( |
125 if txt.startswith(tuple( |
121 [h + ":" for h in |
126 [h + ":" for h in |
122 HgUserConfigHostFingerprintDialog.supportedHashes])): |
127 HgUserConfigHostFingerprintDialog.supportedHashes])): |
123 parts = txt.split(":", 1) |
128 parts = txt.split(":", 1) |
124 if len(parts) == 2: |
129 if len(parts) == 2: |
125 self.fingerprintEdit.setText(parts[1]) |
130 self.fingerprintEdit.setText(parts[1]) |
|
131 hashIndex = self.hashComboBox.findText(parts[0].strip()) |
|
132 if hashIndex > -1: |
|
133 self.hashComboBox.setCurrentIndex(hashIndex) |
|
134 |
126 self.__updateOkButton() |
135 self.__updateOkButton() |
127 |
136 |
128 def getData(self): |
137 def getData(self): |
129 """ |
138 """ |
130 Public method to retrieve the data. |
139 Public method to retrieve the data. |
135 if self.__version < (3, 9, 0): |
144 if self.__version < (3, 9, 0): |
136 fingerprint = self.fingerprintEdit.text() |
145 fingerprint = self.fingerprintEdit.text() |
137 else: |
146 else: |
138 fingerprint = "{0}:{1}".format( |
147 fingerprint = "{0}:{1}".format( |
139 self.hashComboBox.currentText(), |
148 self.hashComboBox.currentText(), |
140 self.fingerprintEdit.text() |
149 self.fingerprintEdit.text().strip() |
141 ) |
150 ) |
142 |
151 |
143 return self.hostEdit.text(), fingerprint |
152 return self.hostEdit.text().strip(), fingerprint |