Commit ddea63aa authored by Laurent Montel's avatar Laurent Montel
Browse files

Adapt to new api (scripted)

parent 188be73f
Pipeline #248868 passed with stage
in 3 minutes and 14 seconds
......@@ -24,7 +24,6 @@
#include "servedialog.h"
#include "backoutdialog.h"
#include <QTextCodec>
#include <QDir>
#include <QAction>
......@@ -41,6 +40,7 @@
#include <KLocalizedString>
#include <KPluginFactory>
#include <kwidgetsaddons_version.h>
#include <QRegularExpression>
K_PLUGIN_CLASS_WITH_JSON(FileViewHgPlugin, "fileviewhgplugin.json")
......@@ -502,10 +502,19 @@ void FileViewHgPlugin::removeFiles()
{
Q_ASSERT(!m_contextItems.isEmpty());
int answer = KMessageBox::questionYesNo(nullptr, xi18nc("@message:yesorno",
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
int answer = KMessageBox::questionTwoActions(nullptr,
#else
int answer = KMessageBox::questionYesNo(nullptr,
#endif
xi18nc("@message:yesorno",
"Would you like to remove selected files "
"from the repository?"));
"from the repository?"), i18n("Remove Files"), KStandardGuiItem::remove(), KStandardGuiItem::cancel());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (answer == KMessageBox::ButtonCode::SecondaryAction) {
#else
if (answer == KMessageBox::No) {
#endif
return;
}
......@@ -687,10 +696,19 @@ void FileViewHgPlugin::exportChangesets()
void FileViewHgPlugin::revert()
{
clearMessages();
int answer = KMessageBox::questionYesNo(nullptr, xi18nc("@message:yesorno",
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
int answer = KMessageBox::questionTwoActions(nullptr,
#else
int answer = KMessageBox::questionYesNo(nullptr,
#endif
xi18nc("@message:yesorno",
"Would you like to revert changes "
"made to selected files?"));
"made to selected files?"), i18n("Revert"), KGuiItem(i18n("Revert")), KStandardGuiItem::cancel());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (answer == KMessageBox::ButtonCode::SecondaryAction) {
#else
if (answer == KMessageBox::No) {
#endif
return;
}
......@@ -707,10 +725,19 @@ void FileViewHgPlugin::revert()
void FileViewHgPlugin::revertAll()
{
int answer = KMessageBox::questionYesNo(nullptr, xi18nc("@message:yesorno",
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
int answer = KMessageBox::questionTwoActions(nullptr,
#else
int answer = KMessageBox::questionYesNo(nullptr,
#endif
xi18nc("@message:yesorno",
"Would you like to revert all changes "
"made to current working directory?"));
"made to current working directory?"), i18n("Revert All"), KGuiItem(i18n("Revert")), KStandardGuiItem::cancel());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (answer == KMessageBox::ButtonCode::SecondaryAction) {
#else
if (answer == KMessageBox::No) {
#endif
return;
}
......@@ -785,10 +812,19 @@ void FileViewHgPlugin::rollback()
lastTransaction = lastTransaction.mid(cutOfFrom);
// ask
int answer = KMessageBox::questionYesNo(nullptr, xi18nc("@message:yesorno",
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
int answer = KMessageBox::questionTwoActions(nullptr,
#else
int answer = KMessageBox::questionYesNo(nullptr,
#endif
xi18nc("@message:yesorno",
"Would you like to rollback last transaction?")
+ "\nrevision: " + lastTransaction);
+ "\nrevision: " + lastTransaction, i18n("Rollback"), KGuiItem(i18n("Rollback")), KStandardGuiItem::cancel());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (answer == KMessageBox::ButtonCode::SecondaryAction) {
#else
if (answer == KMessageBox::No) {
#endif
return;
}
......@@ -846,4 +882,3 @@ QString FileViewHgPlugin::visualDiffExecPath()
}
#include "fileviewhgplugin.moc"
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