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

Adapt to new api (scripted)

parent ab2aaf06
Pipeline #248529 passed with stage
in 3 minutes and 5 seconds
......@@ -24,6 +24,7 @@
#include <QFileDialog>
#include <QHBoxLayout>
#include <QPointer>
#include <kwidgetsaddons_version.h>
ThemeEditorPage::ThemeEditorPage(const QString &projectDir, const QString &themeName, QWidget *parent)
: QWidget(parent)
......@@ -130,12 +131,20 @@ void ThemeEditorPage::installTheme(const QString &themePath)
QDir dir(themePath);
QDir themeDir(themePath + QLatin1Char('/') + mDesktopPage->themeName());
if (themeDir.exists()) {
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const int answer = KMessageBox::questionTwoActions(this,
#else
const int answer = KMessageBox::questionYesNo(this,
i18n("Theme already exists. Do you want to overwrite it?"),
i18n("Theme already exists"),
KStandardGuiItem::overwrite(),
KStandardGuiItem::cancel());
#endif
i18n("Theme already exists. Do you want to overwrite it?"),
i18n("Theme already exists"),
KStandardGuiItem::overwrite(),
KStandardGuiItem::cancel());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (answer == KMessageBox::ButtonCode::SecondaryAction) {
#else
if (answer == KMessageBox::No) {
#endif
return;
}
} else {
......@@ -252,12 +261,20 @@ bool ThemeEditorPage::saveTheme(bool withConfirmation)
{
if (themeWasChanged()) {
if (withConfirmation) {
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const int result = KMessageBox::questionTwoActionsCancel(this,
#else
const int result = KMessageBox::questionYesNoCancel(this,
i18n("Do you want to save current project?"),
i18n("Save current project"),
KStandardGuiItem::save(),
KStandardGuiItem::discard());
#endif
i18n("Do you want to save current project?"),
i18n("Save current project"),
KStandardGuiItem::save(),
KStandardGuiItem::discard());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (result == KMessageBox::ButtonCode::PrimaryAction) {
#else
if (result == KMessageBox::Yes) {
#endif
storeTheme();
} else if (result == KMessageBox::Cancel) {
return false;
......
......@@ -24,6 +24,7 @@
#include <QFileDialog>
#include <QHBoxLayout>
#include <QPointer>
#include <kwidgetsaddons_version.h>
ContactEditorPage::ContactEditorPage(const QString &projectDir, const QString &themeName, QWidget *parent)
: QWidget(parent)
......@@ -119,12 +120,20 @@ void ContactEditorPage::installTheme(const QString &themePath)
QDir dir(themePath);
QDir themeDir(themePath + QLatin1Char('/') + mDesktopPage->themeName());
if (themeDir.exists()) {
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const int answer = KMessageBox::questionTwoActions(this,
#else
const int answer = KMessageBox::questionYesNo(this,
i18n("Theme already exists. Do you want to overwrite it?"),
i18n("Theme already exists"),
KStandardGuiItem::overwrite(),
KStandardGuiItem::cancel());
#endif
i18n("Theme already exists. Do you want to overwrite it?"),
i18n("Theme already exists"),
KStandardGuiItem::overwrite(),
KStandardGuiItem::cancel());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (answer == KMessageBox::ButtonCode::SecondaryAction) {
#else
if (answer == KMessageBox::No) {
#endif
return;
}
} else {
......@@ -268,12 +277,20 @@ bool ContactEditorPage::saveTheme(bool withConfirmation)
{
if (themeWasChanged()) {
if (withConfirmation) {
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const int result = KMessageBox::questionTwoActionsCancel(this,
#else
const int result = KMessageBox::questionYesNoCancel(this,
i18n("Do you want to save current project?"),
i18n("Save current project"),
KStandardGuiItem::save(),
KStandardGuiItem::discard());
#endif
i18n("Do you want to save current project?"),
i18n("Save current project"),
KStandardGuiItem::save(),
KStandardGuiItem::discard());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (result == KMessageBox::ButtonCode::PrimaryAction) {
#else
if (result == KMessageBox::Yes) {
#endif
storeTheme();
} else if (result == KMessageBox::Cancel) {
return false;
......
......@@ -18,6 +18,7 @@
#include <QListWidget>
#include <QStandardPaths>
#include <QVBoxLayout>
#include <kwidgetsaddons_version.h>
using namespace GrantleeThemeEditor;
class GrantleeThemeEditor::ManageThemesPrivate
......@@ -97,8 +98,16 @@ void ManageThemes::slotDeleteTheme()
} else {
msg = i18n("Do you want to remove %1 selected themes?", selectedThemeCount);
}
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const int answer = KMessageBox::questionTwoActions(this, msg, i18n("Remove theme"), KStandardGuiItem::remove(), KStandardGuiItem::cancel());
#else
const int answer = KMessageBox::questionYesNo(this, msg, i18n("Remove theme"), KStandardGuiItem::remove(), KStandardGuiItem::cancel());
#endif
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (answer == KMessageBox::ButtonCode::PrimaryAction) {
#else
if (answer == KMessageBox::Yes) {
#endif
for (QListWidgetItem *item : selectItems) {
if (QDir((d->mLocalDirectory + QLatin1Char('/') + item->text())).removeRecursively()) {
delete item;
......
......@@ -23,6 +23,7 @@
#include <QFileDialog>
#include <QHBoxLayout>
#include <QPointer>
#include <kwidgetsaddons_version.h>
ThemeEditorPage::ThemeEditorPage(const QString &projectDir, const QString &themeName, QWidget *parent)
: QWidget(parent)
......@@ -154,12 +155,20 @@ void ThemeEditorPage::installTheme(const QString &themePath)
QDir dir(themePath);
QDir themeDir(themePath + QLatin1Char('/') + mDesktopPage->themeName());
if (themeDir.exists()) {
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const int answer = KMessageBox::questionTwoActions(this,
#else
const int answer = KMessageBox::questionYesNo(this,
i18n("Theme already exists. Do you want to overwrite it?"),
i18n("Theme already exists"),
KStandardGuiItem::overwrite(),
KStandardGuiItem::cancel());
#endif
i18n("Theme already exists. Do you want to overwrite it?"),
i18n("Theme already exists"),
KStandardGuiItem::overwrite(),
KStandardGuiItem::cancel());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (answer == KMessageBox::ButtonCode::SecondaryAction) {
#else
if (answer == KMessageBox::No) {
#endif
return;
}
} else {
......@@ -279,12 +288,20 @@ bool ThemeEditorPage::saveTheme(bool withConfirmation)
{
if (themeWasChanged()) {
if (withConfirmation) {
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const int result = KMessageBox::questionTwoActionsCancel(this,
#else
const int result = KMessageBox::questionYesNoCancel(this,
i18n("Do you want to save current project?"),
i18n("Save current project"),
KStandardGuiItem::save(),
KStandardGuiItem::discard());
#endif
i18n("Do you want to save current project?"),
i18n("Save current project"),
KStandardGuiItem::save(),
KStandardGuiItem::discard());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (result == KMessageBox::ButtonCode::PrimaryAction) {
#else
if (result == KMessageBox::Yes) {
#endif
storeTheme();
} else if (result == KMessageBox::Cancel) {
return false;
......
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