┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/settings
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <[email protected]>2022-09-30 19:56:52 +0200
committerMéven Car <[email protected]>2022-10-15 07:18:34 +0000
commit5be69f0daba256cd3faad0aaa16dee8447a76af4 (patch)
tree1b3f83de331543ea418fe4a5fb9842431b6454aa /src/settings
parenta509bd76291d330c69cb89284b2d99a3512a199e (diff)
Port away from deprecated KMessageBox Yes/No
GIT_SILENT
Diffstat (limited to 'src/settings')
-rw-r--r--src/settings/contextmenu/contextmenusettingspage.cpp9
-rw-r--r--src/settings/dolphinsettingsdialog.cpp14
-rw-r--r--src/settings/viewpropertiesdialog.cpp14
3 files changed, 37 insertions, 0 deletions
diff --git a/src/settings/contextmenu/contextmenusettingspage.cpp b/src/settings/contextmenu/contextmenusettingspage.cpp
index 3e2ce62d9..974ddb531 100644
--- a/src/settings/contextmenu/contextmenusettingspage.cpp
+++ b/src/settings/contextmenu/contextmenusettingspage.cpp
@@ -24,6 +24,7 @@
#include <kio_version.h>
#include <kiocore_export.h>
#include <kservice_export.h>
+#include <kwidgetsaddons_version.h>
#include <QtGlobal>
#include <KNSWidgets/Button>
@@ -199,14 +200,22 @@ void ContextMenuSettingsPage::applySettings()
VersionControlSettings::self()->save();
if (!laterSelected) {
+#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
+ KMessageBox::ButtonCode promptRestart = KMessageBox::questionTwoActions(window(),
+#else
KMessageBox::ButtonCode promptRestart = KMessageBox::questionYesNo(window(),
+#endif
i18nc("@info", "Dolphin must be restarted to apply the "
"updated version control system settings."),
i18nc("@info", "Restart now?"),
KGuiItem(QApplication::translate("KStandardGuiItem", "&Restart"), QStringLiteral("dialog-restart")),
KGuiItem(QApplication::translate("KStandardGuiItem", "&Later"), QStringLiteral("dialog-later"))
);
+#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
+ if (promptRestart == KMessageBox::ButtonCode::PrimaryAction) {
+#else
if (promptRestart == KMessageBox::ButtonCode::Yes) {
+#endif
Dolphin::openNewWindow();
qApp->quit();
} else {
diff --git a/src/settings/dolphinsettingsdialog.cpp b/src/settings/dolphinsettingsdialog.cpp
index f6c4c8308..eed2f5155 100644
--- a/src/settings/dolphinsettingsdialog.cpp
+++ b/src/settings/dolphinsettingsdialog.cpp
@@ -25,6 +25,8 @@
#include <KWindowConfig>
#include <KMessageBox>
+#include <kwidgetsaddons_version.h>
+
#include <QCloseEvent>
#include <QPushButton>
@@ -179,17 +181,29 @@ void DolphinSettingsDialog::closeEvent(QCloseEvent* event)
return;
}
+#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
+ const auto response = KMessageBox::warningTwoActionsCancel(this,
+#else
const auto response = KMessageBox::warningYesNoCancel(this,
+#endif
i18n("You have unsaved changes. Do you want to apply the changes or discard them?"),
i18n("Warning"),
KStandardGuiItem::save(),
KStandardGuiItem::discard(),
KStandardGuiItem::cancel());
switch (response) {
+#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
+ case KMessageBox::PrimaryAction:
+#else
case KMessageBox::Yes:
+#endif
applySettings();
Q_FALLTHROUGH();
+#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
+ case KMessageBox::SecondaryAction:
+#else
case KMessageBox::No:
+#endif
event->accept();
break;
case KMessageBox::Cancel:
diff --git a/src/settings/viewpropertiesdialog.cpp b/src/settings/viewpropertiesdialog.cpp
index 08d6b1041..30995f1f7 100644
--- a/src/settings/viewpropertiesdialog.cpp
+++ b/src/settings/viewpropertiesdialog.cpp
@@ -18,6 +18,8 @@
#include <KMessageBox>
#include <KWindowConfig>
+#include <kwidgetsaddons_version.h>
+
#if HAVE_BALOO
#include <Baloo/IndexerConfig>
#endif
@@ -347,9 +349,15 @@ void ViewPropertiesDialog::applyViewProperties()
const bool applyToSubFolders = m_applyToSubFolders && m_applyToSubFolders->isChecked();
if (applyToSubFolders) {
const QString text(i18nc("@info", "The view properties of all sub-folders will be changed. Do you want to continue?"));
+#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
+ if (KMessageBox::questionTwoActions(this, text, {},
+ KStandardGuiItem::cont(),
+ KStandardGuiItem::cancel()) == KMessageBox::SecondaryAction) {
+#else
if (KMessageBox::questionYesNo(this, text, {},
KStandardGuiItem::cont(),
KStandardGuiItem::cancel()) == KMessageBox::No) {
+#endif
return;
}
@@ -381,9 +389,15 @@ void ViewPropertiesDialog::applyViewProperties()
if (applyToAllFolders) {
const QString text(i18nc("@info", "The view properties of all folders will be changed. Do you want to continue?"));
+#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
+ if (KMessageBox::questionTwoActions(this, text, {},
+ KStandardGuiItem::cont(),
+ KStandardGuiItem::cancel()) == KMessageBox::SecondaryAction) {
+#else
if (KMessageBox::questionYesNo(this, text, {},
KStandardGuiItem::cont(),
KStandardGuiItem::cancel()) == KMessageBox::No) {
+#endif
return;
}