┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/dolphinview.cpp
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/views/dolphinview.cpp
parenta509bd76291d330c69cb89284b2d99a3512a199e (diff)
Port away from deprecated KMessageBox Yes/No
GIT_SILENT
Diffstat (limited to 'src/views/dolphinview.cpp')
-rw-r--r--src/views/dolphinview.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index 590fe336b..4e5f4c786 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -47,6 +47,8 @@
#include <KProtocolManager>
#include <KUrlMimeData>
+#include <kwidgetsaddons_version.h>
+
#include <QAbstractItemView>
#include <QActionGroup>
#include <QApplication>
@@ -1017,11 +1019,19 @@ void DolphinView::slotItemsActivated(const KItemSet &indexes)
if (indexes.count() > 5) {
QString question = i18np("Are you sure you want to open 1 item?", "Are you sure you want to open %1 items?", indexes.count());
+#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
+ const int answer = KMessageBox::warningTwoActions(this, question, {},
+#else
const int answer = KMessageBox::warningYesNo(this, question, {},
+#endif
KGuiItem(i18ncp("@action:button", "Open %1 Item", "Open %1 Items", indexes.count()),
QStringLiteral("document-open")),
KStandardGuiItem::cancel());
+#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
+ if (answer != KMessageBox::PrimaryAction) {
+#else
if (answer != KMessageBox::Yes) {
+#endif
return;
}
}
@@ -1879,7 +1889,11 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con
KGuiItem yesGuiItem(KStandardGuiItem::yes());
yesGuiItem.setText(i18nc("@action:button", "Rename and Hide"));
+#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
+ const auto code = KMessageBox::questionTwoActions(this,
+#else
const auto code = KMessageBox::questionYesNo(this,
+#endif
oldItem.isFile() ? i18n("Adding a dot to the beginning of this file's name will hide it from view.\n"
"Do you still want to rename it?")
: i18n("Adding a dot to the beginning of this folder's name will hide it from view.\n"
@@ -1890,7 +1904,11 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con
QStringLiteral("ConfirmHide")
);
+#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
+ if (code == KMessageBox::SecondaryAction) {
+#else
if (code == KMessageBox::No) {
+#endif
return;
}
}