diff options
| author | Remko Tronçon <git@el-tramo.be> | 2012-05-12 18:09:25 (GMT) | 
|---|---|---|
| committer | Remko Tronçon <git@el-tramo.be> | 2012-05-12 18:09:25 (GMT) | 
| commit | 159e773b156f531575d0d7e241e2d20c85ee6d7c (patch) | |
| tree | 9116f69b5f20ec07060b73308427ab524305344f /Swift/QtUI/QtLoginWindow.cpp | |
| parent | 0f91f88ac69644fb7e7bdbf601b7e098194490fa (diff) | |
| download | swift-159e773b156f531575d0d7e241e2d20c85ee6d7c.zip swift-159e773b156f531575d0d7e241e2d20c85ee6d7c.tar.bz2 | |
Show Certificate dialog from certificate error window.
Diffstat (limited to 'Swift/QtUI/QtLoginWindow.cpp')
| -rw-r--r-- | Swift/QtUI/QtLoginWindow.cpp | 21 | 
1 files changed, 13 insertions, 8 deletions
| diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index 094f96c..42ebe39 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -506,20 +506,25 @@ void QtLoginWindow::moveEvent(QMoveEvent*) {  	emit geometryChanged();  } -bool QtLoginWindow::askUserToTrustCertificatePermanently(const std::string& message, Certificate::ref certificate) { +bool QtLoginWindow::askUserToTrustCertificatePermanently(const std::string& message, const std::vector<Certificate::ref>& certificates) {  	QMessageBox dialog(this);  	dialog.setText(tr("The certificate presented by the server is not valid."));  	dialog.setInformativeText(P2QSTRING(message) + "\n\n" + tr("Would you like to permanently trust this certificate? This must only be done if you know it is correct.")); -	QString detailedText = tr("Subject: %1").arg(P2QSTRING(certificate->getSubjectName())) + "\n"; -	detailedText += tr("SHA-1 Fingerprint: %1").arg(P2QSTRING(certificate->getSHA1Fingerprint())); -	dialog.setDetailedText(detailedText); - -	dialog.setStandardButtons(QMessageBox::Yes | QMessageBox::No); +	dialog.addButton("Show Certificate", QMessageBox::HelpRole); +	dialog.addButton(QMessageBox::Yes); +	dialog.addButton(QMessageBox::No);  	dialog.setDefaultButton(QMessageBox::No); - -	return dialog.exec() == QMessageBox::Yes; +	while (true) { +		int result = dialog.exec(); +		if (result == QMessageBox::Yes || result == QMessageBox::No) { +			return result == QMessageBox::Yes; +		} +		// FIXME: This isn't very nice, because the dialog disappears every time. We actually need a real +		// dialog with a custom button. +		QtMainWindow::openCertificateDialog(certificates, &dialog); +	}  }  } | 
 Swift
 Swift