Commit 639dc8a0 authored by Laurent Montel's avatar Laurent Montel
Browse files

Adapt to new api (scripted)

parent c65d121d
Pipeline #248497 passed with stage
in 3 minutes and 23 seconds
......@@ -16,6 +16,8 @@
#include <KMessageBox>
#include <KStringHandler>
#include <KWallet>
#include <kwidgetsaddons_version.h>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <qt5keychain/keychain.h>
#else
......@@ -203,20 +205,28 @@ bool Transport::usrSave()
if (!wallet || wallet->writePassword(QString::number(id()), d->password) != 0) {
// wallet saving failed, ask if we should store in the config file instead
if (d->storePasswordInFile
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
|| KMessageBox::warningTwoActions(nullptr,
#else
|| KMessageBox::warningYesNo(nullptr,
i18n("KWallet is not available. It is strongly recommended to use "
"KWallet for managing your passwords.\n"
"However, the password can be stored in the configuration "
"file instead. The password is stored in an obfuscated format, "
"but should not be considered secure from decryption efforts "
"if access to the configuration file is obtained.\n"
"Do you want to store the password for server '%1' in the "
"configuration file?",
name()),
i18n("KWallet Not Available"),
KGuiItem(i18n("Store Password")),
KGuiItem(i18n("Do Not Store Password")))
#endif
i18n("KWallet is not available. It is strongly recommended to use "
"KWallet for managing your passwords.\n"
"However, the password can be stored in the configuration "
"file instead. The password is stored in an obfuscated format, "
"but should not be considered secure from decryption efforts "
"if access to the configuration file is obtained.\n"
"Do you want to store the password for server '%1' in the "
"configuration file?",
name()),
i18n("KWallet Not Available"),
KGuiItem(i18n("Store Password")),
KGuiItem(i18n("Do Not Store Password")))
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
== KMessageBox::ButtonCode::PrimaryAction) {
#else
== KMessageBox::Yes) {
#endif
// write to config file
KConfigGroup group(config(), currentGroup());
group.writeEntry("password", KStringHandler::obscure(storePassword));
......
......@@ -23,6 +23,7 @@
#include <QRandomGenerator>
#include <QRegularExpression>
#include <QStringList>
#include <kwidgetsaddons_version.h>
#include "mailtransport_debug.h"
#include <KConfig>
......@@ -684,19 +685,27 @@ void TransportManagerPrivate::migrateToWallet()
}
// ask user if he wants to migrate
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
int result = KMessageBox::questionTwoActionsList(nullptr,
#else
int result = KMessageBox::questionYesNoList(nullptr,
i18n("The following mail transports store their passwords in an "
"unencrypted configuration file.\nFor security reasons, "
"please consider migrating these passwords to KWallet, the "
"KDE Wallet management tool,\nwhich stores sensitive data "
"for you in a strongly encrypted file.\n"
"Do you want to migrate your passwords to KWallet?"),
names,
i18n("Question"),
KGuiItem(i18n("Migrate")),
KGuiItem(i18n("Keep")),
QStringLiteral("WalletMigrate"));
#endif
i18n("The following mail transports store their passwords in an "
"unencrypted configuration file.\nFor security reasons, "
"please consider migrating these passwords to KWallet, the "
"KDE Wallet management tool,\nwhich stores sensitive data "
"for you in a strongly encrypted file.\n"
"Do you want to migrate your passwords to KWallet?"),
names,
i18n("Question"),
KGuiItem(i18n("Migrate")),
KGuiItem(i18n("Keep")),
QStringLiteral("WalletMigrate"));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (result != KMessageBox::ButtonCode::PrimaryAction) {
#else
if (result != KMessageBox::Yes) {
#endif
return;
}
......
......@@ -13,6 +13,8 @@
#include "ui_transportmanagementwidget.h"
#include <KMessageBox>
#include <kwidgetsaddons_version.h>
#include <QMenu>
using namespace MailTransport;
......@@ -136,8 +138,16 @@ void TransportManagementWidgetPrivate::removeClicked()
? i18n("Do you want to remove outgoing account '%1'?", ui.transportList->selectedItems().at(0)->text(0))
: i18np("Do you really want to remove this %1 outgoing account?", "Do you really want to remove these %1 outgoing accounts?", nbAccount);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const int rc = KMessageBox::questionTwoActions(q, msg, i18n("Remove outgoing account?"), KStandardGuiItem::remove(), KStandardGuiItem::cancel());
#else
const int rc = KMessageBox::questionYesNo(q, msg, i18n("Remove outgoing account?"), KStandardGuiItem::remove(), KStandardGuiItem::cancel());
#endif
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (rc == KMessageBox::ButtonCode::SecondaryAction) {
#else
if (rc == KMessageBox::No) {
#endif
return;
}
for (QTreeWidgetItem *selecteditem : selectedItems) {
......
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