Commit 9fd929a6 authored by Laurent Montel's avatar Laurent Montel
Browse files

Port to not deprecated methods

parent d724f0cb
Pipeline #249437 passed with stage
in 6 minutes
......@@ -139,7 +139,11 @@ void CertificateToPIVCardCommand::Private::start()
"<p>Please confirm that you want to write the following certificate to the %1 slot of card %2:</p>"
"<center>%3</center>",
PIVCard::keyDisplayName(cardSlot), QString::fromStdString(serialNumber()), certificateInfo);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
auto confirmButton = KStandardGuiItem::ok();
#else
auto confirmButton = KStandardGuiItem::yes();
#endif
confirmButton.setText(i18nc("@action:button", "Write certificate"));
confirmButton.setToolTip(QString());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
......
......@@ -30,8 +30,9 @@
#include <gpgme++/key.h>
#include <KLocalizedString>
#include "kleopatra_debug.h"
#include <KLocalizedString>
#include <kwidgetsaddons_version.h>
using namespace Kleo;
using namespace Kleo::Commands;
......@@ -167,12 +168,22 @@ void CertifyCertificateCommand::doStart()
};
if (!findAnyGoodKey()) {
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
auto sel =
KMessageBox::questionTwoActions(d->parentWidgetOrView(),
#else
auto sel = KMessageBox::questionYesNo(d->parentWidgetOrView(),
xi18nc("@info", "To certify other certificates, you first need to create an OpenPGP certificate for yourself.") +
QStringLiteral("<br><br>") +
i18n("Do you wish to create one now?"),
i18n("Certification Not Possible"));
#endif
xi18nc("@info", "To certify other certificates, you first need to create an OpenPGP certificate for yourself.")
+ QStringLiteral("<br><br>") + i18n("Do you wish to create one now?"),
i18n("Certification Not Possible"),
KGuiItem(i18n("Create")),
KStandardGuiItem::cancel());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (sel == KMessageBox::ButtonCode::PrimaryAction) {
#else
if (sel == KMessageBox::Yes) {
#endif
QEventLoop loop;
auto cmd = new NewOpenPGPCertificateCommand;
cmd->setParentWidget(d->parentWidgetOrView());
......
......@@ -47,6 +47,7 @@
#include <KLocalizedString>
#include <KMessageBox>
#include <kwidgetsaddons_version.h>
#include <QByteArray>
#include <QEventLoop>
......@@ -415,16 +416,30 @@ bool ImportCertificatesCommand::Private::showPleaseCertify(const GpgME::Import &
<< i18n("Using a business card.")
<< i18n("Confirming it on a trusted website.");
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
auto sel = KMessageBox::questionTwoActions(parentWidgetOrView(),
#else
auto sel = KMessageBox::questionYesNo(parentWidgetOrView(),
i18n("In order to mark the certificate as valid (green) it needs to be certified.") + QStringLiteral("<br>") +
i18n("Certifying means that you check the Fingerprint.") + QStringLiteral("<br>") +
i18n("Some suggestions to do this are:") +
QStringLiteral("<li><ul>%1").arg(suggestions.join(QStringLiteral("</ul><ul>"))) +
QStringLiteral("</ul></li>") +
i18n("Do you wish to start this process now?"),
i18nc("@title", "You have imported a new certificate (public key)"),
KStandardGuiItem::yes(), KStandardGuiItem::no(), QStringLiteral("CertifyQuestion"));
#endif
i18n("In order to mark the certificate as valid (green) it needs to be certified.") + QStringLiteral("<br>")
+ i18n("Certifying means that you check the Fingerprint.") + QStringLiteral("<br>")
+ i18n("Some suggestions to do this are:")
+ QStringLiteral("<li><ul>%1").arg(suggestions.join(QStringLiteral("</ul><ul>")))
+ QStringLiteral("</ul></li>") + i18n("Do you wish to start this process now?"),
i18nc("@title", "You have imported a new certificate (public key)"),
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
KGuiItem(i18n("Import")),
KStandardGuiItem::cancel(),
#else
KStandardGuiItem::yes(),
KStandardGuiItem::no(),
#endif
QStringLiteral("CertifyQuestion"));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (sel == KMessageBox::ButtonCode::PrimaryAction) {
#else
if (sel == KMessageBox::Yes) {
#endif
QEventLoop loop;
auto cmd = new Commands::CertifyCertificateCommand(key);
cmd->setParentWidget(parentWidgetOrView());
......@@ -587,10 +602,22 @@ static void handleOwnerTrust(const std::vector<ImportResultData> &results)
QString::fromUtf8(fingerPr),
uids);
int k = KMessageBox::questionYesNo(nullptr, str, i18nc("@title:window",
"Secret key imported"));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
int k = KMessageBox::questionTwoActions(nullptr,
str,
#else
int k = KMessageBox::questionYesNo(nullptr,
str,
#endif
i18nc("@title:window", "Secret key imported"),
KGuiItem(i18n("Import")),
KStandardGuiItem::cancel());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (k == KMessageBox::ButtonCode::PrimaryAction) {
#else
if (k == KMessageBox::Yes) {
#endif
//To use the ChangeOwnerTrustJob over
//the CryptoBackendFactory
const QGpgME::Protocol *const backend = QGpgME::openpgp();
......@@ -1040,6 +1067,5 @@ void ImportCertificatesCommand::doCancel()
#undef d
#undef q
#include "moc_importcertificatescommand.cpp"
#include "importcertificatescommand.moc"
#include "moc_importcertificatescommand.cpp"
......@@ -77,9 +77,9 @@ void GroupsConfigPage::Private::onKeysMayHaveChanged()
if (!changed) {
q->load();
} else {
auto buttonYes = KStandardGuiItem::yes();
auto buttonYes = KStandardGuiItem::ok();
buttonYes.setText(i18n("Save changes"));
auto buttonNo = KStandardGuiItem::no();
auto buttonNo = KStandardGuiItem::cancel();
buttonNo.setText(i18n("Discard changes"));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const auto answer = KMessageBox::questionTwoActions(
......
......@@ -235,7 +235,7 @@ void AutoDecryptVerifyFilesController::Private::exec()
qCDebug(KLEOPATRA_LOG) << "Moving " << inpath << " to " << outpath;
const QFileInfo ofi(outpath);
if (ofi.exists()) {
int sel = KMessageBox::No;
int sel = KMessageBox::Cancel;
if (!overWriteAll) {
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
sel = KMessageBox::questionTwoActionsCancel(m_dialog,
......
......@@ -622,7 +622,7 @@ void CertificateDetailsWidget::Private::revokeUserID(const GpgME::UserID &userId
"@info",
"<para>Do you really want to revoke the user ID<nl/><emphasis>%1</emphasis> ?</para>",
QString::fromUtf8(userId.id()));
auto confirmButton = KStandardGuiItem::yes();
auto confirmButton = KStandardGuiItem::ok();
confirmButton.setText(i18nc("@action:button", "Revoke User ID"));
confirmButton.setToolTip({});
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment