Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/jobuidelegate.cpp
Show First 20 Lines • Show All 294 Lines • ▼ Show 20 Line(s) | 185 | { | |||
---|---|---|---|---|---|
295 | return true; | 295 | return true; | ||
296 | } | 296 | } | ||
297 | 297 | | |||
298 | int KIO::JobUiDelegate::requestMessageBox(KIO::JobUiDelegate::MessageBoxType type, | 298 | int KIO::JobUiDelegate::requestMessageBox(KIO::JobUiDelegate::MessageBoxType type, | ||
299 | const QString &text, const QString &caption, | 299 | const QString &text, const QString &caption, | ||
300 | const QString &buttonYes, const QString &buttonNo, | 300 | const QString &buttonYes, const QString &buttonNo, | ||
301 | const QString &iconYes, const QString &iconNo, | 301 | const QString &iconYes, const QString &iconNo, | ||
302 | const QString &dontAskAgainName, | 302 | const QString &dontAskAgainName, | ||
303 | const KIO::MetaData &sslMetaData) | 303 | const KIO::MetaData &metaData) | ||
304 | { | 304 | { | ||
305 | int result = -1; | 305 | int result = -1; | ||
306 | 306 | | |||
307 | //qDebug() << type << text << "caption=" << caption; | 307 | //qDebug() << type << text << "caption=" << caption; | ||
308 | 308 | | |||
309 | KConfig config(QStringLiteral("kioslaverc")); | 309 | KConfig config(QStringLiteral("kioslaverc")); | ||
310 | KMessageBox::setDontShowAgainConfig(&config); | 310 | KMessageBox::setDontShowAgainConfig(&config); | ||
311 | 311 | | |||
Show All 25 Lines | 333 | case WarningContinueCancel: | |||
337 | break; | 337 | break; | ||
338 | case Information: | 338 | case Information: | ||
339 | KMessageBox::information(window(), text, caption, dontAskAgainName, options); | 339 | KMessageBox::information(window(), text, caption, dontAskAgainName, options); | ||
340 | result = 1; // whatever | 340 | result = 1; // whatever | ||
341 | break; | 341 | break; | ||
342 | case SSLMessageBox: { | 342 | case SSLMessageBox: { | ||
343 | QPointer<KSslInfoDialog> kid(new KSslInfoDialog(window())); | 343 | QPointer<KSslInfoDialog> kid(new KSslInfoDialog(window())); | ||
344 | //### this is boilerplate code and appears in khtml_part.cpp almost unchanged! | 344 | //### this is boilerplate code and appears in khtml_part.cpp almost unchanged! | ||
345 | const QStringList sl = sslMetaData.value(QStringLiteral("ssl_peer_chain")).split(QLatin1Char('\x01'), QString::SkipEmptyParts); | 345 | const QStringList sl = metaData.value(QStringLiteral("ssl_peer_chain")).split(QLatin1Char('\x01'), QString::SkipEmptyParts); | ||
346 | QList<QSslCertificate> certChain; | 346 | QList<QSslCertificate> certChain; | ||
347 | bool decodedOk = true; | 347 | bool decodedOk = true; | ||
348 | for (const QString &s : sl) { | 348 | for (const QString &s : sl) { | ||
349 | certChain.append(QSslCertificate(s.toLatin1())); //or is it toLocal8Bit or whatever? | 349 | certChain.append(QSslCertificate(s.toLatin1())); //or is it toLocal8Bit or whatever? | ||
350 | if (certChain.last().isNull()) { | 350 | if (certChain.last().isNull()) { | ||
351 | decodedOk = false; | 351 | decodedOk = false; | ||
352 | break; | 352 | break; | ||
353 | } | 353 | } | ||
354 | } | 354 | } | ||
355 | 355 | | |||
356 | if (decodedOk) { | 356 | if (decodedOk) { | ||
357 | result = 1; // whatever | 357 | result = 1; // whatever | ||
358 | kid->setSslInfo(certChain, | 358 | kid->setSslInfo(certChain, | ||
359 | sslMetaData.value(QStringLiteral("ssl_peer_ip")), | 359 | metaData.value(QStringLiteral("ssl_peer_ip")), | ||
360 | text, // the URL | 360 | text, // the URL | ||
361 | sslMetaData.value(QStringLiteral("ssl_protocol_version")), | 361 | metaData.value(QStringLiteral("ssl_protocol_version")), | ||
362 | sslMetaData.value(QStringLiteral("ssl_cipher")), | 362 | metaData.value(QStringLiteral("ssl_cipher")), | ||
363 | sslMetaData.value(QStringLiteral("ssl_cipher_used_bits")).toInt(), | 363 | metaData.value(QStringLiteral("ssl_cipher_used_bits")).toInt(), | ||
364 | sslMetaData.value(QStringLiteral("ssl_cipher_bits")).toInt(), | 364 | metaData.value(QStringLiteral("ssl_cipher_bits")).toInt(), | ||
365 | KSslInfoDialog::certificateErrorsFromString(sslMetaData.value(QStringLiteral("ssl_cert_errors")))); | 365 | KSslInfoDialog::certificateErrorsFromString(metaData.value(QStringLiteral("ssl_cert_errors")))); | ||
366 | kid->exec(); | 366 | kid->exec(); | ||
367 | } else { | 367 | } else { | ||
368 | result = -1; | 368 | result = -1; | ||
369 | KMessageBox::information(window(), | 369 | KMessageBox::information(window(), | ||
370 | i18n("The peer SSL certificate chain appears to be corrupt."), | 370 | i18n("The peer SSL certificate chain appears to be corrupt."), | ||
371 | i18n("SSL"), QString(), options); | 371 | i18n("SSL"), QString(), options); | ||
372 | } | 372 | } | ||
373 | // KSslInfoDialog deletes itself (Qt::WA_DeleteOnClose). | 373 | // KSslInfoDialog deletes itself (Qt::WA_DeleteOnClose). | ||
374 | delete kid; | 374 | delete kid; | ||
375 | break; | 375 | break; | ||
376 | } | 376 | } | ||
377 | case WarningContinueCancelDetailed: { | ||||
378 | const QString details = metaData.value(QStringLiteral("privilege_conf_details")); | ||||
379 | result = KMessageBox::warningContinueCancelDetailed( | ||||
dfaure: two spaces after `=`, remove one | |||||
380 | window(), text, caption, KStandardGuiItem::cont(), KStandardGuiItem::cancel(), | ||||
381 | dontAskAgainName, options | KMessageBox::Dangerous, details); | ||||
dfaure: I don't think you need the `KMessageBox::Options(` around the value? | |||||
382 | break; | ||||
383 | } | ||||
377 | default: | 384 | default: | ||
378 | qCWarning(KIO_WIDGETS) << "Unknown type" << type; | 385 | qCWarning(KIO_WIDGETS) << "Unknown type" << type; | ||
379 | result = 0; | 386 | result = 0; | ||
380 | break; | 387 | break; | ||
381 | } | 388 | } | ||
382 | KMessageBox::setDontShowAgainConfig(nullptr); | 389 | KMessageBox::setDontShowAgainConfig(nullptr); | ||
383 | return result; | 390 | return result; | ||
384 | } | 391 | } | ||
Show All 38 Lines |
two spaces after =, remove one